Repository navigation
wallet: avoid MarkUnused P2MR full top-up - #31
Conversation
0bbf38e to
7918b76
Compare
PR ReviewFindingsNo blocking findings from this review pass. Consensus Impact
This does not change transaction or block validity, but it changes P2MR wallet keypool refill timing, descriptor persistence, and private-key material availability around transaction sync/rescan paths. That is wallet/funds-safety adjacent, especially for P2MR-only wallets. Review ScopeReviewed issue #14, PR body, commit metadata, changed files, full diff, surrounding wallet/SPKM code, direct call sites, comments/reviews, review-thread state, and visible CI status. The PR has no comments, reviews, or unresolved review threads at the time of review. Deep Checks PerformedTraced Issue FitThe PR matches #14’s main contract: ranged P2MR descriptors avoid unconditional full qbit-Specific ChecksChecked P2MR descriptor keypool behavior, PQC private-key persistence assumptions, receive/change internal hinting, recovery lookahead, locked encrypted wallet behavior, explicit Validation ReviewedPR body reports local Residual RiskI did not rerun the wallet unit tests locally because no existing build directory was present. I also did not benchmark the MarkUnused path; this review relies on code/test inspection for the “no full top-up above watermark” claim. The PR uses direct unit coverage for |
7918b76 to
23a400c
Compare
* wallet: avoid MarkUnused P2MR full top-up * wallet: avoid MarkUnused lock inversion * wallet: preserve P2MR recovery lookahead
* Accept legacy AuxPoW RPC payloads (#23) * Prevent AuxPoW signalling in permissionless GBT (#22) * wallet: defer P2MR getnewaddress keypool refill (#13) * wallet: defer P2MR getnewaddress keypool refill * wallet: bound internal P2MR keypool refill * wallet: align P2MR top-up lock ordering * wallet: schedule raw change P2MR refills * wallet: report paused P2MR refills as failed * wallet: log inline P2MR refill failures * ci: fix BuildKit helper lint * Document AuxPoW commitment order fields (#35) * Restrict explicit wallet output types on P2MR-only chains (#25) * Restrict explicit wallet output types * test: run BECH32 wallet suites on unrestricted regtest * fuzz: run wallet transaction target on unrestricted regtest * Fix BuildKit helper lint * Report missing wallet output managers accurately * Allow managerless wallets with default output options * test: add independent P2MR and CTV script vectors (#29) * Add independent P2MR PQC witness vector tests (#30) * test: add independent P2MR PQC witness vector * test: verify P2MR wrong-domain vector signature * Fix AuxPoW legacy payload disambiguation * wallet: avoid MarkUnused P2MR full top-up (#31) * wallet: avoid MarkUnused P2MR full top-up * wallet: avoid MarkUnused lock inversion * wallet: preserve P2MR recovery lookahead * Split P2MR wallet unit tests (#52) * Remove unused P2MR wallet test import (#58) * Shard P2MR wallet unit tests (#60) * Add independent CHECKDATASIGPQC vector tests (#38) * test: add P2MR data-hash proof fixtures (#43) * test: add independent P2MR commitment vectors (#47) * Reject invalid raw funding outputs (#37) * Validate witness-pruned assumevalid before wipe (#59) * Add independent CHECKDATASIGADDPQC vector tests (#42) * qt: recommend wallet encryption by default (#62) * Verify libbitcoinpqc tagged subtree imports (#41) * ci: verify libbitcoinpqc tagged subtree imports * ci: handle peeled libbitcoinpqc tag refs * ci: peel libbitcoinpqc tag objects before compare * ci: pass auth to libbitcoinpqc verifier * ci: pin libbitcoinpqc verifier inputs * ci: verify libbitcoinpqc import tree * Add P2MR PQC annex sighash vectors (#54) * Add P2MR PQC annex sighash vectors * Guard annex mutation vector test * Add P2MR data signature support to Qt Sign/Verify (#63) * qt: add P2MR data signature dialog * qt: support text data in P2MR signatures * qt: align P2MR proof verification with RPC * test: add P2MR CHECKSIGPQC sighash vectors (#55) * Add rawmr future-leaf coverage (#64) * test: cover P2MR SIGHASH_SINGLE missing outputs (#57) * test: add P2MR PQC codeseparator vectors (#56) * Fix PQC data-hash counter accounting (#46) * Fix PQC data-hash counter accounting * Fix PQC data-hash leaf error priority * Report final PQC slot failures as exhausted * doc: add v0.1.2-testnet4 release notes * build: bump version to v0.1.2-testnet4
Summary
MarkUnusedAddressesfor ranged P2MR descriptors when the receive pool is still above the low watermark.MarkUnusedAddresses, while preserving full lookahead for recovery/rescan paths.next_index.Base
0.1.xafter PR wallet: defer P2MR getnewaddress keypool refill #13 merged.Validation
cmake --build build_dev_mode --target test_bitcoin -j8build_dev_mode/bin/test_qbit '--run_test=wallet_tests/MarkUnusedAddresses*'\n-build_dev_mode/bin/test_qbit '--run_test=wallet_tests/P2MRGetNew*'\n- Docker lint:DOCKER_BUILDKIT=1 docker build -t qbit-linter-issue14 --file "./ci/lint_imagefile" . && docker run --rm -v "$PWD":/bitcoin -v /Users/miller/conductor/repos/qbit-v1/.git:/Users/miller/conductor/repos/qbit-v1/.git qbit-linter-issue14\n\n## Related\n- Addresses Avoid full synchronous P2MR keypool top-up from MarkUnusedAddresses #14.Note
Medium Risk
Changes wallet keypool refill timing on transaction detection and rescan for P2MR descriptors; incorrect behavior could affect address availability but is scoped and heavily tested.
Overview
Ranged P2MR descriptors no longer trigger a full synchronous keypool top-up from
MarkUnusedAddresseswhen the receive pool is still above the low watermark. Instead they use bounded low-watermark refill viaTopUpWithInternalHintResult, skip refill for scripts already consumed byGetNewDestination, and defer refill when the wallet is locked (with logging).A new
MarkUnusedAddressesOptions(internal_hint,preserve_full_keypool_lookahead) is threaded through the SPKM API.CWallet::AddToWalletIfInvolvingMesetspreserve_full_keypool_lookaheadduring old-block rescan so recovery still restores full lookahead; non-P2MR descriptors keep the previous full top-up behavior.Deferred create keypool state is persisted when address use advances
next_index(including clearing the flag on P2MRGetNewDestinationwhen appropriate). Wallet tests cover above-watermark, generated scripts, bounded refill, recovery lookahead, locked wallets, and non-P2MR.Reviewed by Cursor Bugbot for commit 23a400c. Bugbot is set up for automated code reviews on this repo. Configure here.