3 minor findings · 12 suggestions
Earlier concerns neither republished nor resolved: 1 major finding · 6 minor findings · 5 suggestions. See the Run archive for their assessments.
Findings
[minor] · Malleated SP transactions lose their fee-bump metadata
A different-txid legacy variant receives neither SP field, so an input-adding fee bump after a reorg can retain a script that the recipient's scan cannot find.
Location: src/wallet/wallet.cpp:2163 (head).
Details and suggested fix
CommitTransaction records the SP flag and recipients only on the original transaction. For a P2PKH-funded transaction, the wallet can later learn a consensus-valid variant with a different scriptSig and txid but otherwise identical contents. IsMalleation recognizes it, but SyncMalleatedTxMetadata copies neither SP field. If the variant's block is disconnected, an otherwise eligible bumpfee treats its outputs as fixed P2TR destinations. Adding an eligible input changes the BIP352 derivation while retaining those scripts, so the recipient cannot discover the replacement payment by scanning. Copy both SP fields between variants and persist each variant's sprecipients record; WriteTxMetadata alone does not write that record. Extend wallet_txn_clone.py with an SP recipient and an input-adding bump. No production occurrence of this sequence was found.
[minor] · Backup recovery leaves SP fee-bump safety undefined
Restoring a pre-send backup can relearn a pending SP payment without its metadata, allowing an input-adding bump to retain scripts that the recipient's scan cannot find.
Location: src/wallet/feebumper.cpp:263 (head).
Details and suggested fix
The missing-recipient guard only protects transactions whose SP flag survived. Restoring a backup taken before the send relearns outgoing mempool transactions through AddToWalletIfInvolvingMe, which inserts them without the creation callback that records either SP field. Another wallet instance holding the same descriptors has the same limitation. An ordinary bumpfee then preserves the P2TR scripts and can add confirmed inputs, for example when bumping a changeless SP sweep with a spare confirmed coin. Define the recovery contract: either refuse input-changing bumps of unflagged transactions paying non-wallet P2TR outputs unless explicit outputs are supplied, or document this limitation in RPC help and release notes. The conservative refusal also restricts ordinary recovered taproot payments because their scripts do not reveal SP provenance. Add a pre-send-backup restore test with an input-adding bump. No production occurrence of this sequence was found.
[minor] · SP anchors can exceed the combined input-weight budget
send with covering, SP-ineligible preset inputs can add an anchor that pushes the transaction above max_tx_weight or the TRUC size limit.
Location: src/wallet/spend.cpp:1009 (head).
Details and suggested fix
With ineligible inputs that already cover the target and add_inputs=true, the fallback checks only the anchor's own weight before adding it to the presets. The retried SelectCoins returns through the MANUAL path, bypassing the combined-weight check after automatic selection. The final construction check compares only against MAX_STANDARD_TX_WEIGHT, so a lower caller limit is not enforced. For version=3, this can produce a transaction exceeding TRUC_MAX_WEIGHT; mempool policy rejects it even though send can return its txid after committing it. Check the combined input weight, including existing presets, before accepting an anchor result, then try another anchor or return the weight error. No current caller combining these options was found.
Optional improvements
[suggestion] · Unsupported SP options are rejected after private-key checks and funding
Unsupported SP change addresses can trigger unlock errors or full coin selection before fundrawtransaction and walletcreatefundedpsbt report that the option is unsupported.
Location: src/wallet/rpc/spend.cpp:884 (head).
Details and suggested fix
The shared RPC FundTransaction parses the SP change address, calls MaybeEnableSilentPayments, and funds the transaction before either caller rejects it. Watch-only and external-signer wallets therefore get a private-key error, locked wallets get an unlock error, and unlocked wallets can perform selection and output derivation unnecessarily. Base rejected the address during decoding. send similarly checks SP-incompatible psbt=true and add_to_wallet=false only after construction, which has already kept an automatic change destination and can skip a change index. Reject unsupported combinations after parsing recipients and change but before enabling SP or funding. A per-caller allowance passed to the shared helper would retain send's supported SP change behavior.
[suggestion] · The downgrade marker also makes unconfirmed SP change unsafe
In older readers with the base code's replacement-metadata handling, the placeholder blocks safe automatic selection of unconfirmed SP change as well as fee bumping.
Location: src/wallet/transaction.h:297 (head).
Details and suggested fix
Such readers load SILENT_PAYMENTS_TX_TAG into m_replaced_by_txid. Their AvailableCoins marks unconfirmed outputs of replaced transactions unsafe, so a downgraded wallet skips the SP send's change during safe automatic selection, including a default attempt to CPFP a stuck send. Setting include_unsafe can permit selection under the remaining eligibility rules, and confirmation removes this unsafe-selection restriction. Document this downgrade behavior alongside the intended bumpfee refusal in the release note.
[suggestion] · SP validation results and sending restrictions lack API documentation
The help does not explain valid SP results without a scriptPubKey, and the new sending RPC behavior has no PR release note.
Location: src/rpc/output_script.cpp:81 (head).
Details and suggested fix
validateaddress now returns isvalid=true, isscript=false, and iswitness=false for SP addresses, with neither scriptPubKey nor an SP indicator. Although scriptPubKey is already optional, the help does not explain this newly accepted address class or how clients should distinguish it. Document that result shape, or add an explicit SP indicator. Also add the PR release note requested by doc/developer-notes.md: describe SP support in sendtoaddress, sendmany, send, sendall, and bumpfee, the required wallet insertion and PSBT restrictions, and the rejected SP change addresses in fundrawtransaction and walletcreatefundedpsbt.
[suggestion] · SP recipient cleanup precedes durable replacement marking
An interruption between recipient erasure and replacement marking can leave the original transaction unreplaced on disk but unable to reconstruct a fee bump.
Location: src/wallet/feebumper.cpp:455 (head).
Details and suggested fix
After committing the replacement, CommitTransaction erases the original's sprecipients record before MarkReplaced persists replaced_by_txid through a separate metadata write. A stop between these writes, or a failed marking write, leaves the original's SP placeholder without its recipients after reload. An ordinary bump then fails with the missing-recipient error. This is fail-closed, and the replacement retains its own record. Move the erase after a successful MarkReplaced; leaving the old record behind on failure is harmless.
[suggestion] · An SP recipient without the coin-control flag reaches an abort
A future caller supplying an SP recipient without m_silent_payments would reach an assertion instead of receiving the error already provided for SP change.
Location: src/wallet/spend.cpp:1513 (head).
Details and suggested fix
With m_silent_payments unset, CreateTransactionInternal skips output derivation and eventually asserts that the SP recipient has a static script. It does not, and Assert aborts in production builds. The analogous SP change mismatch returns a normal error. No current caller producing this mismatch was found, but interfaces::Wallet::createTransaction forwards arbitrary CRecipient vectors without enforcing the invariant. Add an early recipient-side error mirroring the change check, before construction reaches the assertion.
[suggestion] · SP recipient tests do not verify the amount-to-recipient mapping
The functional helper checks discovery counts only, so swapping the amounts paid to the two SP recipients would leave the assertions passing.
Location: test/functional/wallet_silentpayments_sending.py:512 (head).
Details and suggested fix
test_multiple_sp_recipients requests 3 BTC and 4 BTC for different scan keys, but assert_sp_outputs only checks that each recipient discovers one output. Pairing the derived scripts with the wrong recipient amounts would preserve both counts. Map each discovered output key back to its vout and assert the value, including after an input-adding fee bump and in the mixed-output case. For sendall, compare with the computed remainder split rather than the fixed requested amounts, because do_send passes only addresses to that RPC.
[suggestion] · Fail-closed SP fee-bump checks lack negative tests
The current tests do not exercise missing or mismatched recipient data, so removing either refusal would leave their assertions unchanged.
Location: src/wallet/feebumper.cpp:263 (head).
Details and suggested fix
The reload test keeps the sprecipients record intact and expects a successful bump. It never reaches either fail-closed guard, even though the flag and recipient record are stored separately and an unreadable record is a noncritical load error. Add two unloaded-wallet edits followed by reload: delete the record in one case and replace it with valid but wrong recipient data in the other. Reuse the sendall/maxconf fixture with a spare confirmed coin so an unsafe bump would add an input. Assert the specific bumpfee error and an unchanged mempool in both cases.
[suggestion] · sendall's skipped-SP-coin refusal has no functional test
The P2WSH-only test exercises missing shared-secret inputs, not the new refusal to silently leave unusable coins behind.
Location: src/wallet/rpc/spend.cpp:1611 (head).
Details and suggested fix
Without explicit inputs, SP sendall refuses to sweep if AvailableCoins skipped any unusable coin. No current test reaches this branch: P2WSH coins are permitted inputs, so the existing case instead fails because none contributes to the shared secret. Fund an eligible P2WPKH coin and a tr(<xonly pub>,pk(<priv>)) coin whose internal private key is missing. The leaf private key permits importing that descriptor, while its coin fails the SP input check. Assert the skipped-coins error and that nothing was spent. Then explicitly select only the P2WPKH coin and verify the payment with scan_tx.
[suggestion] · The test scanner keeps scanning future-witness transactions
The Python oracle can report an SP payment in a transaction that BIP352 and the production receiver exclude entirely.
Location: test/functional/test_framework/bip352.py:51 (head).
Details and suggested fix
scan() drops a native future-witness input's unrecognized public key and derives outputs from the remaining eligible inputs. The production receiver instead skips the whole transaction when any native prevout has witness version greater than 1. This leaves the independent oracle unable to detect a sender regression admitting such inputs. Before summing keys, return no matches for native witness programs above version 1 without rejecting other unrecognized scripts. Add a unit case with an eligible input, a v2 input, and an otherwise matching output.
[suggestion] · SP fee-bump dialog behavior has no Qt coverage
The existing Qt fee-bump cases cannot check early unlocking, SP recipient forwarding, or suppression of unsigned export.
Location: src/qt/walletmodel.cpp:456 (head).
Details and suggested fix
WalletModel::bumpFee now unlocks before constructing an SP replacement, carries sp_recipients through the wallet interface, and suppresses the PSBT option. The Qt tests bump only ordinary PKHash sends in an unencrypted wallet. Extend the MiniGUI fixture with an SP transaction created through the wallet API, then invoke fee bumping from a locked, encrypted wallet with PSBT controls enabled. Check that unlocking precedes confirmation, unsigned export is unavailable, cancellation restores the lock state, and a committed replacement retains its recipients.
[suggestion] · SP tests do not cover untweaked rawtr input keys
Removing the rawtr key path or mistakenly tweaking its key would not be detected by the current taproot SP tests.
Location: src/wallet/scriptpubkeyman.cpp:1563 (head).
Details and suggested fix
GetPrivKeyForSilentPayments returns the output key's keypair untweaked for rawtr, before the internal-key tweak path used by the existing tr(...) fixtures. Those tests cannot distinguish removal of this branch from correct rawtr handling, or catch accidental tweaking that produces undiscoverable outputs. Fund a rawtr(<priv>) coin with fund_descriptor, spend that outpoint alone through sendall, and verify the resulting payment with scan_tx. A public-only rawtr case can also extend the input-check unit matrix.
[suggestion] · The oversized sendall test funds the same fixture twice
The first rejection leaves its 1600 coins unspent, so the SP iteration adds another pool and processes about 3200 inputs unnecessarily.
Location: test/functional/wallet_sendall.py:599 (head).
Details and suggested fix
sendall_fails_with_transaction_too_large refills the keypool, funds 1600 outputs, and mines inside the target loop. The first size error occurs before signing or commit, leaving those coins available for the second iteration, which also performs SP key derivation. Move fixture funding before the loop and assert both target rejections against the same 1600-coin pool, which already exceeds the transaction-size limit for either target.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [minor]: Fallback skips eligible anchors with non-positive effective value
- [suggestion]: Anchor retries can bypass least-waste selection
- [suggestion]: Measure repeated anchor-selection retries
- [minor]: A Silent Payments change address can fail a send with no change
- [minor]: Anchor fallback can bypass avoid-partial-spends grouping
- [minor]: Fee bump can misclassify a fixed Taproot output as silent payment
- [major]: Fee bump can misclassify a duplicate-script output as silent payment
- [minor]: bumpfee can direct change to an address-less script (earlier report)
- [minor]: SP send ignores the requested input reservation (earlier report)
- [suggestion]: Input-type fixtures change type after the first RPC (earlier report)
- [suggestion]: Retained same-scan-key outputs lack lifecycle coverage (earlier report)
- [suggestion]: Ancestor-funding test repeats without exercising SP funding (earlier report)