You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Wallet drain: let the host cap the swept balance at what the user confirmed #5607
shielded_fund_from_wallet_drain (Swift shieldedFundFromWalletDrain(walletId:operationId:fundingAccountIndex:recipientRaw43:)) selects its inputs when it builds the asset lock: every eligible UTXO at that moment. The host can only show the user a read-only shielded_wallet_drain_preview beforehand. AssetLockFunding::DrainWalletBalance carries minimum_lock_duffs but no upper bound and no input snapshot.
For a drain to the wallet's own Orchard address that is harmless. For an external recipient (dashpay/dashwallet-ios#1251) a UTXO that becomes eligible between the confirmation and the build is swept to the third party — money the user never saw on the confirm screen. dashwallet-ios re-reads the preview after authorization and refuses when the candidate balance grew, which narrows the window to the time between that preview and input selection, but cannot close it.
Proposal
Add an optional bound the build enforces on the inputs it actually selects, e.g. maximum_candidate_balance_duffs: Option<u64> on DrainWalletBalance (and a matching FFI / Swift parameter): if the selected candidate balance exceeds it, fail with a typed notSent error before signing or broadcasting, so the host can show a fresh estimate. Alternatively accept the exact outpoint set from the preview, but a balance cap is simpler and enough for "never send more than confirmed".
Activity
docs(wallet): state what the external drain balance check cannot bind
feat(wallet): Max to an external shielded address uses the SDK wallet…