Skip to content

fix(bitcoin): align onAmountInput with getMaxSendableAmount - #645

Open
ulissesferreira wants to merge 1 commit into
WPN-2442-bitcoin-get-max-sendable-amountfrom
WPN-2442-bitcoin-align-on-amount-input-with-max
Open

ulissesferreira wants to merge 1 commit into
WPN-2442-bitcoin-get-max-sendable-amountfrom
WPN-2442-bitcoin-align-on-amount-input-with-max

Conversation

@ulissesferreira

Copy link
Copy Markdown
Contributor

Explanation

onAmountInput and getMaxSendableAmount disagreed on the full spendable balance. The max probe never drains the wallet, while onAmountInput drained whenever the entered amount equaled the balance, so the reported max was smaller than an input onAmountInput would still accept.

This PR makes both paths share one probe (RpcHandler.#probeAmount) and makes the probe always add the amount as a recipient, even when it equals the balance. onAmountInput now rejects the full balance with InsufficientBalanceToCoverFee unless the entered amount also covers the fee, exactly as getMaxSendableAmount does. Actual sends still drain when the amount equals the balance, and the internal send form's SetMax behavior is unchanged.

References

Ticket: WPN-2442

Stacked on: #587

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

@ulissesferreira
ulissesferreira force-pushed the WPN-2442-bitcoin-align-on-amount-input-with-max branch 2 times, most recently from 1075f05 to c3b84ca Compare November 17, 2026 16:04
@ulissesferreira
ulissesferreira marked this pull request as ready for review November 17, 2026 16:09
@ulissesferreira
ulissesferreira requested review from a team as code owners November 17, 2026 16:09
@ulissesferreira
ulissesferreira force-pushed the WPN-2442-bitcoin-align-on-amount-input-with-max branch from c3b84ca to 93eb8e0 Compare November 17, 2026 16:25
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

1 participant