walletrpc: make no-expiry leases explicit #11396
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.48) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 539 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.376
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #11396"
general
weight: 0.35
Roasbeef
Summary
Make the RPC lease lifetime introduced by #11125 explicit. That PR's confirmation-count parameters obscure that unused outputs are reserved indefinitely. Replace the count-based RPC lifetime controls and readback with explicit booleans, using the existing wallet lease mechanism.
Issue
The confirmation target does not set an expiration deadline. Any nonzero value disables wall-clock expiry while a UTXO remains unused. Choosing three confirmations instead of another nonzero count makes no difference to that reservation: the output stays locked indefinitely.
The count controls lease-record cleanup after a spending transaction confirms. While the spending transaction remains tracked, ordinary wallet spend tracking already excludes that input from coin selection before confirmation. A retained depth-N lease can keep the input reserved if a previously confirmed spender is reorged out and then removed from the wallet, including removal without a confirmed conflict. This PR deliberately chooses cleanup at the first confirmed spend; a reorg does not restore that removed reservation.
Reorg handling also does not turn the confirmation target into a deadline for an unused input:
The parameter therefore obscures an indefinite reservation behind a confirmation target that does not define when an unused input becomes available. Its name is confusing and easy to misuse as a reservation that automatically expires after several blocks.
The resulting indefinite reservation can strand an otherwise spendable input after transaction failure:
1. U is leased with
ReleaseAfterSpendConfs = 3.2. Transaction A spends U, later fails, and is removed from the wallet.
3. Removing A clears U's spent marker, making U otherwise unspent.
4. U's lease remains active, so ordinary coin selection still excludes it.
5. Automatic cleanup requires a spending transaction to reach three confirmations. With A gone, additional blocks cannot advance that condition.
Waiting for more blocks alone never unlocks U; the owner must explicitly release its lease to make the unspent input available for a new payment. The new flags make this responsibility explicit. A no-expiry lease still requires owner release if its spending transaction never confirms.
Change Description
LeaseOutput.release_after_spend_confswithno_expiry, andFundPsbt.input_release_after_spend_confswithinput_lease_no_expiry. Remove therelease_after_spend_confsresponse fields fromLeaseOutputResponseandUtxoLease. Reserve all four retired protobuf field numbers and names. Callers must migrate and verify the returned boolean acknowledgement.Internally,
no_expirymaps to the existingReleaseAfterSpendConfs = 1wallet option. Keeping that option is the minimal fix: it reuses wallet storage and cleanup without changing btcwallet. A confirmation count does not define an expiration deadline for an unused input and should not be presented as an expiry policy in btcwallet or other projects. This API expresses no expiry directly and explicitly ends the reservation at the first confirmed spend.Validation: focused WalletKit unit tests, the no-expiry RPC integration lifecycle, package and integration lint, protobuf lint/generation checks, and release-note validation passed.