Skip to content

Conversation

@NeoZ666
Copy link
Collaborator

@NeoZ666 NeoZ666 commented Jan 4, 2026

  • Currently, can_use_regular only checks against target, not adding the estimated_fee.
  • The coinselection crate also overshoots the fee by some sats, above the { estimated_fee + target } range.

Now,

  • This gives an edge case where can_use_regular can be flagged as true, but coinselect fails due to the overshoot difference(This becomes an issue when the target amount is small). As a fix :
  • Addition of fee during calc of can_use_x bool.
  • Added a debug log for fee.
  • Loops through swap if regular isn't enough. An important caveat : During manual selection, it instead throws a harderror when either chosen balance type is insufficient and does NOT loop through the other balance type.

Below is a swap with the new behavior :
image

Copy link

@mojoX911 mojoX911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack. Tested that the error is not occurring anymore.

Signed-off-by: neoz666 <neoz.blockchain@gmail.com>
@codecov
Copy link

codecov bot commented Jan 4, 2026

Codecov Report

❌ Patch coverage is 90.96386% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.25%. Comparing base (776b75d) to head (ab1f336).
⚠️ Report is 81 commits behind head on master.

Files with missing lines Patch % Lines
src/wallet/api.rs 90.96% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #691      +/-   ##
==========================================
+ Coverage   68.87%   78.25%   +9.38%     
==========================================
  Files          35       49      +14     
  Lines        4932    15251   +10319     
==========================================
+ Hits         3397    11935    +8538     
- Misses       1535     3316    +1781     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mojoX911 mojoX911 merged commit a43219a into citadel-tech:master Jan 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Coin Selection Fails Due to Insufficient Fee Accounting in Balance Check

2 participants