Skip to content

backport: bitcoin#29421, bitcoin#29419, bitcoin#29798, bitcoin#30494, bitcoin#30659, bitcoin#28366, bitcoin#30524 - #8168

Merged
knst merged 7 commits into
dashpay:developfrom
thepastaclaw:backport-0.28-b011-src
Nov 26, 2026
Merged

knst merged 7 commits into
dashpay:developfrom
thepastaclaw:backport-0.28-b011-src

Conversation

@DCG-Claude

@DCG-Claude DCG-Claude commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

Backports 7 Bitcoin Core v0.28 pull request(s) to Dash.

What was done?

  • net: make the list of known message types a compile time constant bitcoin/bitcoin#29421 — net: make the list of known message types a compile time constant.
    Upstream: net: make the list of known message types a compile time constant bitcoin/bitcoin#29421 (merge 6c13b13). Dash commit: b78c4c9.
    Backports net: make the list of known message types a compile time constant bitcoin/bitcoin#29421: NetMsgType names, Dash's included, become inline constexpr definitions in protocol.h, and getAllNetMessageTypes() is replaced by the header array ALL_NET_MESSAGE_TYPES. The Dash-only call sites in net.cpp and net_processing.cpp and the Dash name mapping in the fuzz runner are updated to match, and Dash's compile-time message-length check is kept as a static_assert.

    Dash adaptations:

    • src/protocol.h: no FEEFILTER/WTXIDRELAY constants or ALL_NET_MESSAGE_TYPES entries; Dash does not implement feefilter or wtxidrelay
    • src/protocol.h: Dash message types (SPORK..PLATFORMBAN) become inline constexpr with their existing strings (e.g. DSACCEPT{"dsa"}) and stay in ALL_NET_MESSAGE_TYPES in Dash's order
    • src/protocol.h: adds #include ‹array› for std::array/std::to_array; upstream's protocol.h already had this include
    • src/protocol.cpp: Dash's MAKE_MSG macro and its compile-time COMMAND_SIZE static_assert go away with the definitions; the runtime assert in CMessageHeader's constructor still applies
    • src/protocol.cpp: keeps Dash's blocks-only message list and NetMessageViolatesBlocksOnly(); its comment now refers to ALL_NET_MESSAGE_TYPES in protocol.h
    • src/net.cpp: Dash-only CalculateNumConnectionsChangedStats() loops now use ALL_NET_MESSAGE_TYPES instead of getAllNetMessageTypes()
    • src/net_processing.cpp: Dash-only extension-message lookup in ProcessMessage() now uses ALL_NET_MESSAGE_TYPES instead of getAllNetMessageTypes()
    • test/fuzz/test_runner.py: Dash maps NetMsgType names to message strings by parsing the protocol.h constexpr definitions instead of lowercasing (DSACCEPT is "dsa")
    • src/test/fuzz/p2p_transport_serialization.cpp: g_all_messages stays outside an anonymous namespace; Dash's version of this file never had that namespace
  • wallet: fix UnloadWallet thread safety assumptions bitcoin/bitcoin#30659 — wallet: fix UnloadWallet thread safety assumptions.
    Upstream: wallet: fix UnloadWallet thread safety assumptions bitcoin/bitcoin#30659 (merge 99ecb9a). Dash commit: b21cf9e.
    Backports wallet: fix UnloadWallet thread safety assumptions bitcoin/bitcoin#30659: RemoveWallet() now notifies unload right away, UnloadWallet is renamed to WaitForDeleteWallet and no longer asserts it is the only caller, and ReleaseWallet is renamed to FlushAndDeleteWallet; Dash-only call sites and comments are updated to match. It also re-applies Fix crash when closing wallet bitcoin-core/gui#835 unchanged, which dash#6881 had reverted because this prerequisite was missing; without it the GUI would remove a closed wallet twice and crash.

    Dash adaptations:

    • src/wallet/wallet.cpp: RemoveWallet() adds NotifyUnload() after the wallets_mutex block, ahead of Dash's CoinJoin loader RemoveWallet() call, which is kept
    • src/wallet/rpc/wallet.cpp: unloadwallet keeps Dash's call position after PushWarnings (wallet still needed for the walletwarningfield check); only renamed to WaitForDeleteWallet
    • src/wallet/test/fuzz/notifications.cpp: Dash-only UnloadWallet() call in ~FuzzedWallet renamed to WaitForDeleteWallet (upstream's file has no such call)
    • src/wallet/wallet.cpp: Dash-only comment in the MigrateLegacyToDescriptor failure cleanup now names WaitForDeleteWallet() instead of UnloadWallet()
  • Fix waste calculation in SelectionResult bitcoin/bitcoin#28366 — Fix waste calculation in SelectionResult.
    Upstream: Fix waste calculation in SelectionResult bitcoin/bitcoin#28366 (merge 701b0cf). Dash commit: 486ee03.
    Backports Fix waste calculation in SelectionResult bitcoin/bitcoin#28366: Dash's free-function GetSelectionWaste is folded into SelectionResult::RecalculateWaste (renamed from ComputeAndSetWaste), so waste is computed from the actual change decision, and all Dash call sites, the benchmark, the fuzz target and the tests are updated to match. The bump_fee_group_discount parts come from Bump unconfirmed ancestor transactions to target feerate bitcoin/bitcoin#26152, which Dash does not have, so they are left out, and the tests are adapted to Dash's CoinSet helpers and byte-based transaction size.

    Dash adaptations:

    Not applicable to Dash (intentionally omitted):

  • log: deduplicate category names and improve logging.cpp bitcoin/bitcoin#29419 — log: deduplicate category names and improve logging.cpp.
    Upstream: log: deduplicate category names and improve logging.cpp bitcoin/bitcoin#29419 (merge 3b987d0). Dash commit: c11a0a6.
    Replaces the duplicated LogCategories array and LogCategoryToStr switch with a sorted string→flag std::map and a derived flag→string unordered_map. All Dash categories carry over, and the commit keeps NET_NETCONN's "net|netconn" name, LogCategoriesList's enabled_only parameter and its DASH exclusion. The UTIL-removal commit renumbers BLOCKSTORAGE..TXPACKAGES to bits 25..28 as upstream does; Dash had already dropped UTIL itself.

    Dash adaptations:

    • src/logging.cpp: LOG_CATEGORIES_BY_STR uses Dash's enum names BCLog::BENCHMARK and BCLog::RANDOM (Dash never renamed them to BENCH/RAND); the strings "bench"/"rand" are unchanged
    • src/logging.cpp: Dash categories (chainlocks, gobject, instantsend, llmq, llmq-dkg, llmq-sigs, mnpayments, mnsync, coinjoin, spork, netconn, creditpool, ehf, dash) move into LOG_CATEGORIES_BY_STR in string-›flag form
    • src/logging.cpp: LOG_CATEGORIES_BY_FLAG also maps NET_NETCONN to "net|netconn", which Dash's removed switch returned; it is not a parseable category so it cannot go in the string map
    • src/logging.cpp: LogCategoriesList keeps Dash's enabled_only parameter and its exclusion of the BCLog::DASH group flag, now looping over LOG_CATEGORIES_BY_STR
    • src/logging.h: UTIL removal (bitcoin commit b0344c2) only renumbers BLOCKSTORAGE..TXPACKAGES to bits 25..28; Dash never had UTIL, and Dash's 64-bit flags and ALL = ~(uint64_t)0 are kept
  • Logging cleanup bitcoin/bitcoin#29798 — Logging cleanup.
    Upstream: Logging cleanup bitcoin/bitcoin#29798 (merge 55d1994). Dash commit: 3be1df5.
    This backports Logging cleanup bitcoin/bitcoin#29798 completely. The special categories (0, empty, 1, all) move out of LOG_CATEGORIES_BY_STR into GetLogCategory and LogCategoryToStr, GetLogPrefix becomes private, m_categories starts as BCLog::NONE, and the -debug/-debugexclude help and the RPC logging help are corrected. The only differences from upstream are mechanical Dash adaptations: the 64-bit category field, the std::string signatures, the Dash categories and NET_NETCONN alias, and LogCategoriesList's enabled_onl

    Dash adaptations:

    • src/logging.h: m_categories keeps Dash's std::atomic‹uint64_t› type (Dash has 64-bit LogFlags); only the initializer becomes BCLog::NONE as upstream
    • src/logging.cpp: LOG_CATEGORIES_BY_STR keeps Dash's plain std::map (no std::less‹›, which comes from a separate string_view PR) and its Dash categories; only the 0/""/1/all entries are removed
    • src/logging.cpp: LogCategoriesList keeps Dash's enabled_only filter and BCLog::DASH exclusion; only the now-redundant NONE/ALL checks are dropped
    • src/rpc/node.cpp: removes only the "none"/"0" help line; Dash's "dash" and "deactivate all" help lines stay
  • fuzz: reduce keypool size in scriptpubkeyman target bitcoin/bitcoin#30494 — fuzz: reduce keypool size in scriptpubkeyman target.
    Upstream: fuzz: reduce keypool size in scriptpubkeyman target bitcoin/bitcoin#30494 (merge 8754d05). Dash commit: 24cb742.
    clean cherry-pick

  • doc: rpc: Use "output script" consistently (2/2) bitcoin/bitcoin#30524 — doc: rpc: Use "output script" consistently (2/2).
    Upstream: doc: rpc: Use "output script" consistently (2/2) bitcoin/bitcoin#30524 (merge 1900336). Dash commit: 93c1660.
    This backports doc: rpc: Use "output script" consistently (2/2) bitcoin/bitcoin#30524, which changes RPC help text to say "output script" instead of "scriptPubKey"/"script key" in all nine upstream files, keeping Dash's address example, the DIP-18 Platform wording and Dash-only fields. It leaves out two help lines about segwit witness scripts, because Dash has no such fields.

    Dash adaptations:

    • src/rpc/blockchain.cpp: scantxoutset comment keeps Dash's example address XcJSEb79...; combo() help keeps Dash's 'P2PK and P2PKH' wording
    • src/rpc/output_script.cpp: validateaddress scriptPubKey help keeps Dash's DIP-18 Platform sentence; deriveaddresses raw() line keeps Dash's narrower column width (no wpkh/tr examples)
    • src/wallet/rpc/addresses.cpp: wording change applied around Dash's isplatform result field
    • src/wallet/rpc/transactions.cpp: wording change applied in Dash's TransactionDescriptionString (keeps DS/to fields, no bip125-replaceable)

    Not applicable to Dash (intentionally omitted):

    • src/rpc/rawtransaction.cpp: analyzepsbt 'witnessscript' help line (witness script wording); Dash has no segwit and no such result field
    • src/wallet/rpc/coins.cpp: listunspent 'witnessScript' help line (P2WSH wording); Dash has no segwit and no such result field

How Has This Been Tested?

Breaking Changes

None beyond the upstream changes themselves.

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

@DCG-Claude

DCG-Claude commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator Author

Maintainer controls

Tick a box; backportsys acts within a few minutes, then clears it. For other requests, leave a review comment.

  • 🔒 Hands off — stop every automated update to this branch
  • 🔄 Rebase onto current develop
  • ❌ Close — abandon this batch and release its items

Hands off persists after its box clears: no automated branch updates until operator release (not tracker Release hold). Close abandons the batch and releases its items.

Review confidence

🟢 4/5 overall (4 at 5/5, 3 at 4/5).

How sure the system is that each commit is exactly right, so how much review it needs: 5 clean or plainly correct, a glance · 4 small adaptations, check the noted spots · 3 real judgment calls, review them · 2 substantial or risky, review in full · 1 not checked, or the system doubts it. The independent reviewer gives the score; a failed check, a partial landing or an owed restore caps it. Below 5 the cause of concern says why. The adapting lane's explanations are in the PR description and each commit body.

Upstream Confidence Cause of concern Where it differs from upstream
bitcoin#29421 🟢 4/5 To keep Dash's compile-time COMMAND_SIZE check, the commit adds a third copy of the message-name list, as a static_assert array in protocol.cpp. A message type later added only to protocol.h's ALL_NET_MESSAGE_TYPES would skip the length check, which the old per-definition MAKE_MSG check would have caught. The names and order in the list match the parent tree exactly. Check: src/protocol.cpp: confirm the static_assert array lists the same 74 names as ALL_NET_MESSAGE_TYPES and that the lambda's check matches the old MAKE_MSG bound; test/fuzz/test_runner.py: confirm the new char* /{ split maps each identifier to its string (e.g. DSACCEPT -› dsa) for the protocol.h layout Dash code differs from upstream in src/net.cpp, src/net_processing.cpp, src/protocol.cpp, src/protocol.h; edits a Dash-only line in src/protocol.h: extern const char* QUORUMROTATIONINFO;; removes 2 Dash-only lines in src/protocol.cpp that upstream does not, the first MAKE_MSG(SPORK, "spork");; removes a Dash-only line in src/protocol.h that upstream does not: extern const char* SPORK;; docs/tests/build differ in test/fuzz/test_runner.py
bitcoin#30659 🟢 4/5 The commit also brings in bitcoin-core/gui#835, the GUI fix Dash reverted in dash#6881. Without it, the earlier NotifyUnload would remove a wallet from the GUI twice and crash. In Dash, NotifyUnload now fires before the CoinJoin loader drops the wallet, where it used to fire after; GUI handling is queued, so this looks harmless. Check: src/qt/walletcontroller.cpp: confirm closeWallet/closeAllWallets now rely only on the queued WalletModel::unload path (gui#835 re-applied verbatim); src/wallet/wallet.cpp: confirm it is fine that NotifyUnload() runs before coinjoin_loader-›RemoveWallet(name) in RemoveWallet() Dash code differs from upstream in src/qt/walletcontroller.cpp, src/qt/walletcontroller.h, src/wallet/wallet.cpp, src/wallet/wallet.h; docs/tests/build differ in src/wallet/test/fuzz/notifications.cpp; same lines as upstream, placement adapted for Dash in src/wallet/rpc/wallet.cpp
bitcoin#28366 🟢 4/5 waste_test is rewritten to fill a CoinSet and call AddInputs, because Dash lacks the fee-aware add_coin(SelectionResult&) overload, and check_max_weight's byte-based max_weight formula is Dash's own version of upstream's weight formula. I checked both and found them equivalent, but neither is a verbatim copy. Check: src/wallet/test/coinselector_tests.cpp: check that the waste_test rewrite (CoinSet + AddInputs, subtract_fee_outputs=false) keeps every scenario's expected waste the same as upstream; src/wallet/test/coinselector_tests.cpp: check that max_weight = MAX_STANDARD_TX_SIZE - (tx_noinputs_size + change_output_size) is the right byte-based version of upstream's weight bound Dash code differs from upstream in src/wallet/coinselection.cpp, src/wallet/coinselection.h, src/wallet/spend.cpp; docs/tests/build differ in src/bench/coin_selection.cpp, src/wallet/test/coinselector_tests.cpp; skips upstream hunks as not needed in Dash: src/wallet/spend.cpp, src/wallet/test/coinselector_tests.cpp
bitcoin#29419 🟢 5/5 none Dash code differs from upstream in src/logging.cpp, src/logging.h; removes 21 Dash-only lines in src/logging.cpp that upstream does not, the first {BCLog::CHAINLOCKS, "chainlocks"},
bitcoin#29798 🟢 5/5 none Dash code differs from upstream in src/logging.cpp, src/logging.h; same lines as upstream, placement adapted for Dash in src/rpc/node.cpp
bitcoin#30494 🟢 5/5 none identical to upstream
bitcoin#30524 🟢 5/5 none Dash code differs from upstream in src/rpc/blockchain.cpp, src/rpc/output_script.cpp; same lines as upstream, placement adapted for Dash in src/wallet/rpc/addresses.cpp, src/wallet/rpc/transactions.cpp; skips upstream hunks as not needed in Dash: src/rpc/rawtransaction.cpp, src/wallet/rpc/coins.cpp

Needs maintainer input

  • net: make the list of known message types a compile time constant bitcoin/bitcoin#29421: Keep Dash's compile-time COMMAND_SIZE check (dash#4614) as a static_assert over a duplicated name list in protocol.cpp, or drop it and rely on the runtime assert in CMessageHeader as upstream does? The commit keeps it; I would keep it, ideally checking ALL_NET_MESSAGE_TYPES' source list directly in a follow-up so there is no third list to keep in sync.

Local checks without a pass or fail result (fork CI's full run covers these):

Fork gate: thepastaclaw#149 at 93c1660 (CI pending).

@thepastaclaw

thepastaclaw commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

🕓 Review not started yet because the new head is waiting for the 30-minute push debounce.

  • Request normal review — click when the PR is ready for review.
  • Request priority review — click to move this review to the front of the queue.

Commit 93c1660. Normal review starts when eligible; priority review starts as soon as a slot is available.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The change updates logging category parsing, reporting, and help text. Protocol message definitions move to the header, and networking and fuzzing code use the new message-type array. Compact-block extra transactions use transaction references. Wallet deletion waiting and Qt wallet removal change, and coin selection waste calculation is revised. Related tests, benchmarks, RPC descriptions, and fuzz setup code are also updated.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: Minimal · up to 0368d

This backport of Bitcoin Core changes (protocol message definitions, logging, wallet deletion, coin selection waste, RPC wording) shows no concrete defect in review. Normal CI should be confirmed before merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title lists seven upstream Bitcoin Core backport PR numbers. The changeset matches them: compile-time message types (bitcoin#29421), compact-block extra transactions (bitcoin#29752), wallet waste …
Description check Passed The description lists the eight Bitcoin Core v0.28 backports (bitcoin#29421, #30659, #28366, #29419, #29798, #30494, #30524) and explains each Dash-specific adaptation. It matches the changeset in pro…
Full details: Title check

Explanation

The title lists seven upstream Bitcoin Core backport PR numbers. The changeset matches them: compile-time message types (bitcoin#29421), compact-block extra transactions (bitcoin#29752), wallet waste calculation (bitcoin#28366), logging cleanup (bitcoin#29419, bitcoin#29798), fuzz keypool size (bitcoin#30494), wallet unload thread safety (bitcoin#30659), and RPC 'output script' wording (bitcoin#30524). The title identifies the change as a backport, but it lists PR numbers rather than the primary change, and it is long at 113 characters. It is related to the changeset, so it passes, though it is not a concise summary of the main change.

Full details: Description check

Explanation

The description lists the eight Bitcoin Core v0.28 backports (bitcoin#29421, #30659, #28366, #29419, #29798, #30494, #30524) and explains each Dash-specific adaptation. It matches the changeset in protocol.h/cpp, net.cpp, logging.cpp, wallet coinselection, wallet unload, and RPC help text. The description is detailed and on-topic, so it passes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1d60e988-6058-4872-9057-fa983d712a10
Commits

Reviewing files that changed from the base of the PR and between 1892fe6 and 0368d06.

Files selected for processing: 2

  • src/qt/walletcontroller.cpp
  • src/qt/walletcontroller.h

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@thepastaclaw thepastaclaw left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 1 + Phase 2

Updated after discussion: 1 finding(s) of this review were settled in the inline threads.

  • ✅ Withdrawn: 💬 Stale extra-transaction API comment remains

The backport range is functionally sound and the available lint, cppcheck, fuzz-build, and depends checks pass. One stale API comment remains after the compact-block extra-transaction container changed from hash/reference pairs to transaction references; source builds are still queued or in progress, with no failed code checks reported.

💬 1 0 nitpick(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: backport-reviewer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: dash-core-commit-history); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: backport-reviewer); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — This is a broad but ordinary backport affecting protocol message declarations and network-related call sites, logging, and tests, without the diff itself changing consensus, funds movement, cryptography, or peer-facing network deserialization behavior.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — backport-reviewer (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — dash-core-commit-history (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — backport-reviewer (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — dash-core-commit-history (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `src/blockencodings.h`:
- [NITPICK → WITHDRAWN in discussion; do not fix] src/blockencodings.h:142: Stale extra-transaction API comment remains
  `InitData` now accepts `std::vector<CTransactionRef>`, and the implementation computes the instance hash from each transaction. The comment still describes the argument as being in `<hash, reference>` form, which is no longer accurate and can mislead callers about the required input. Update it to describe a list of transaction references.

Comment thread src/blockencodings.h

explicit PartiallyDownloadedBlock(CTxMemPool* poolIn) : pool(poolIn) {}

// extra_txn is a list of extra transactions to look at, in <hash, reference> form

@thepastaclaw thepastaclaw Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Withdrawn at 0feb1934; see the replies below.

💬 Nitpick: Stale extra-transaction API comment remains

InitData now accepts std::vector<CTransactionRef>, and the implementation computes the instance hash from each transaction. The comment still describes the argument as being in <hash, reference> form, which is no longer accurate and can mislead callers about the required input. Update it to describe a list of transaction references.

Suggested change
// extra_txn is a list of extra transactions to look at, in <hash, reference> form
// extra_txn is a list of extra transactions to look at

source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.1-sol (phase2-reviewer: general, backport-reviewer, dash-core-commit-history)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The backport matches upstream: bitcoin#29752 changed only the InitData signature and left this comment as it was (upstream's merge 7cc9a08 still says "in <witness hash, reference> form"). Rewording it would be a cleanup upstream never made, so it belongs in a separate upstream or Dash change, not this backport.


🤖 backportsys, on behalf of the Dash backport pipeline.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the parent diff and agree that this is an unchanged upstream comment carried through the faithful backport, rather than a Dash-specific adaptation error. The wording is stale relative to the upstream API change, but updating it here would be a separate documentation cleanup, so I withdraw this nitpick for this backport.

Withdrawing this finding.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Withdrawn (re-reviewed at 0feb1934): The comment is still unchanged, but your upstream-equivalence explanation is correct: bitcoin#29752 left the old hash/reference wording in place. Changing it would be separate cleanup rather than a defect introduced by this backport, so I withdraw this finding for the current head.

@thepastaclaw thepastaclaw added the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 16, 2026
@PastaPastaPasta PastaPastaPasta added this to the 24.1 milestone Nov 16, 2026
@DCG-Claude

Copy link
Copy Markdown
Collaborator Author

CI failed at e359425 on dashpay/dash: linux64_tsan-build / Build source

The linux64_tsan failure is a ThreadSanitizer data race inside the vendored dashbls mimalloc (mi_tld_free vs _mi_meta_free in dashbls/runtest), with no frame from this branch's code; the branch touches no dashbls, sanitizer or CI files. Develop commit 84f36b2 adds race:dashbls/depends/mimalloc/ to test/sanitizer_suppressions/tsan for exactly this stack, and the branch base b46c5d1 doesn't have it, so rebasing onto develop resolves it. This branch is based on b46c5d1c73, older than develop (b3fb478e1b); it is being rebased onto develop and this is looked at again there.


🤖 backportsys, on behalf of the Dash backport pipeline.

@DCG-Claude
DCG-Claude force-pushed the backport-0.28-b011-src branch from e359425 to a301cb8 Compare November 16, 2026 05:14
@thepastaclaw thepastaclaw added pastaclaw:approved thepastaclaw's latest review approved this PR and removed pastaclaw:approved thepastaclaw's latest review approved this PR labels Nov 16, 2026
@DCG-Claude DCG-Claude changed the title backport: bitcoin#29421, bitcoin#29752, bitcoin#29419, bitcoin#29798 backport: bitcoin#29421, bitcoin#29752, bitcoin#29419, bitcoin#29798, bitcoin#30494, bitcoin#30659, bitcoin#28366, bitcoin#30524 Nov 16, 2026
@thepastaclaw thepastaclaw removed the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 16, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

The eight-commit backport matches the declared upstream changes and Dash adaptations, with no in-scope correctness issues identified. The compile-time command-length check was intentionally removed by the upstream change, and the omitted bump-fee test depends on functionality explicitly excluded from this backport. Lint, cppcheck, ClangFormat, and completed build checks pass; remaining build checks are still pending with no reported failures.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: backport-reviewer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — This large, cross-cutting backport changes wallet coin selection and peer-facing compact-block/wtxid serialization in addition to protocol and logging code, meeting the critical-surface bar.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — backport-reviewer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — dash-core-commit-history (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

@thepastaclaw thepastaclaw added the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 17, 2026
@PastaPastaPasta

Copy link
Copy Markdown
Member

Dash's compile-time check that every message name fits in COMMAND_SIZE (the static_assert inside MAKE_MSG, from dash#4614) is dropped without a replacement. Only the runtime assert in CMessageHeader's constructor is left, although static_asserts on the new constexpr constants in protocol.h could have kept the check. All current names are 12 characters or fewer, so nothing breaks today. It needs a maintainer decision (listed below). Check: src/protocol.h: decide whether to restore the compile-time COMMAND_SIZE length check from dash#4614 (e.g. static_assert over the constexpr NetMsgType constants); src/protocol.h: confirm the Dash message strings and the order of ALL_NET_MESSAGE_TYPES are unchanged from the old protocol.cpp (they matched when I compared)

please keep this compile time static check for length being valid.

@DCG-Claude
DCG-Claude force-pushed the backport-0.28-b011-src branch from 0feb193 to 1892fe6 Compare November 18, 2026 19:22
@DCG-Claude

Copy link
Copy Markdown
Collaborator Author

I put the compile-time length check back in src/protocol.cpp. It is a single static_assert that runs std::ranges::all_of over all 74 constexpr NetMsgType constants and fails if any is longer than CMessageHeader::COMMAND_SIZE. protocol.cpp passes a syntax-only compile, and I confirmed the assert fires when a message name is made too long. Separately, the Dash message strings and their order in ALL_NET_MESSAGE_TYPES are the same as in the old protocol.cpp. (folded into the bitcoin#29421 commit)


🤖 backportsys, on behalf of the Dash backport pipeline.

@thepastaclaw thepastaclaw removed the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 18, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

The wallet unload backport introduces a real Qt lifecycle regression: both wallet-close paths still delete WalletModel directly even though RemoveWallet now queues the unload callback that also deletes it. Two non-blocking concerns remain in the backport adaptations: the compile-time command-length check uses a separate manual registry, and compact-block reconstruction recomputes uncached Dash instance hashes. CI shows no failed code checks, but several build and test jobs are still pending.

🔴 1 blocking | 🟡 1 suggestion(s)

Follow-up candidates (optional) (1)

New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.

🟡 Suggestion: Retain cached instance hashes for compact-block reconstruction
src/blockencodings.cpp:146

The backport changes the extra-transaction cache from (hash, transaction) pairs to bare transaction references, so this loop recomputes GetInstanceHash() on every scan. Most Dash transactions return the cached hash, but asset-unlock transactions for which IsAssetUnlockWithStableTxid() is true serialize and hash the full transaction on each call. Compact-block reconstruction can scan the whole extra-transaction ring, making this a repeated hot-path cost. Keep the instance hash alongside each cached transaction, or otherwise cache it when inserting into the ring, while preserving the Dash-specific instance-hash semantics.

source: gpt-6.2-sol (phase2-reviewer: general, backport-reviewer, dash-core-commit-history)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: backport-reviewer); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The eight backports span several subsystems, but the coin-selection behavior change in src/wallet/coinselection.cpp is a contained fix to waste scoring when change costs zero, not an intricate rewrite of selection logic.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Code unchanged since the last final review (0feb1934): 1 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 1 confirmed; 1 new suggestion(s) listed as follow-up candidates, not posted inline
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — backport-reviewer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — dash-core-commit-history (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `src/wallet/wallet.cpp`:
- [BLOCKING] src/wallet/wallet.cpp:200-201: Wallet removal now schedules a second deletion in Dash Qt
  `RemoveWallet()` now calls `NotifyUnload()`, which reaches `WalletModel::unload` and the queued `WalletController` callback connected in `src/qt/walletcontroller.cpp:154-166`. That callback captures the raw `WalletModel*` and calls `removeAndDeleteWallet()`. However, `closeWallet()` still calls `removeAndDeleteWallet()` immediately after `wallet().remove()`, and `closeAllWallets()` still emits `walletRemoved` and deletes each model directly. When the queued unload callback runs, it can emit `walletRemoved` again and delete the already-freed model, causing a use-after-free or crash. Restore the companion GUI fix from `20763f11014` so both close paths only remove the wallet from the node and let the unload handler own model deletion.

  _Raised on code unchanged since the last review, and confirmed by an independent pass: With a wallet loaded in Dash Qt, confirm Close Wallet or Close All Wallets. The close handler deletes the WalletModel immediately, then the queued unload callback uses the freed pointer and attempts to delete the model again._

In `src/protocol.cpp`:
- [SUGGESTION] src/protocol.cpp:14-16: Keep the command-length check tied to the message definitions
  The new assertion checks a second, hand-maintained array in `protocol.cpp`, while `protocol.h` tells future contributors only to update `ALL_NET_MESSAGE_TYPES`. A future message can therefore be defined and registered without being included in the assertion, silently losing the compile-time `COMMAND_SIZE` safeguard that the former `MAKE_MSG` macro applied at each definition. Tie the check to the definitions or derive both the registry and assertion from one source.

Comment thread src/wallet/wallet.cpp
Comment on lines +200 to +201
// Notify unload so that upper layers release the shared pointer.
wallet->NotifyUnload();

@thepastaclaw thepastaclaw Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Resolved at 0368d066; see the replies below.

🔴 Blocking: Wallet removal now schedules a second deletion in Dash Qt

RemoveWallet() now calls NotifyUnload(), which reaches WalletModel::unload and the queued WalletController callback connected in src/qt/walletcontroller.cpp:154-166. That callback captures the raw WalletModel* and calls removeAndDeleteWallet(). However, closeWallet() still calls removeAndDeleteWallet() immediately after wallet().remove(), and closeAllWallets() still emits walletRemoved and deletes each model directly. When the queued unload callback runs, it can emit walletRemoved again and delete the already-freed model, causing a use-after-free or crash. Restore the companion GUI fix from 20763f11014 so both close paths only remove the wallet from the node and let the unload handler own model deletion.

Raised on code unchanged since the last review, and confirmed by an independent pass: With a wallet loaded in Dash Qt, confirm Close Wallet or Close All Wallets. The close handler deletes the WalletModel immediately, then the queued unload callback uses the freed pointer and attempts to delete the model again.

source: gpt-6.2-sol (phase2-reviewer: general)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed: Dash had reverted gui#835 (826221b) because Dash lacked bitcoin#30659's early NotifyUnload(). With this backport in place, closeWallet()/closeAllWallets() deleted the WalletModel while the queued unload handler still held the pointer. I re-applied gui#835 (20763f1): both close paths now only call removeWallet(), and the unload handler owns deleting the model, as upstream does after bitcoin#30659. (folded into the bitcoin#30659 commit)


🤖 backportsys, on behalf of the Dash backport pipeline.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved (re-reviewed at 0368d066): I verified your gui#835 restoration in 6798b1b4204: both close actions now request removal without deleting the model, leaving deletion to the queued unload handler.

Comment thread src/protocol.cpp
Comment on lines +14 to 16
// Compile-time check that every message type fits in CMessageHeader::COMMAND_SIZE.
static_assert(std::ranges::all_of(std::array{
NetMsgType::VERSION,

@thepastaclaw thepastaclaw Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚖️ Disputed (left to the maintainers; not blocking) at 19ab299a; see the replies below.

🟡 Suggestion: Keep the command-length check tied to the message definitions

The new assertion checks a second, hand-maintained array in protocol.cpp, while protocol.h tells future contributors only to update ALL_NET_MESSAGE_TYPES. A future message can therefore be defined and registered without being included in the assertion, silently losing the compile-time COMMAND_SIZE safeguard that the former MAKE_MSG macro applied at each definition. Tie the check to the definitions or derive both the registry and assertion from one source.

source: gpt-6.2-sol (phase2-reviewer: general, backport-reviewer, dash-core-commit-history)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upstream bitcoin#29421 has no compile-time COMMAND_SIZE check at all; the MAKE_MSG static_assert was Dash-only. The backport keeps that check in a best-effort form, and the runtime assert in CMessageHeader still covers every message. ALL_NET_MESSAGE_TYPES is a std::string array, so a static_assert can't be derived from it, and tying the check to each definition would mean restructuring upstream's protocol.h layout, which is out of scope for this backport.


🤖 backportsys, on behalf of the Dash backport pipeline.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still applies (re-reviewed at 0368d066): You're right that the owning std::string array isn't constexpr, but its literal inputs can be checked before constructing it without moving the NetMsgType declarations. The V2 long-form sender doesn't construct a CMessageHeader, so the constructor assertion doesn't cover that path.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disputed (re-reviewed at 19ab299a): We still disagree on this one, and my answer is above, so I'm leaving the call to the maintainers. It no longer blocks this pull request, and I won't raise it again unless a later change brings the problem back.

@thepastaclaw thepastaclaw added the pastaclaw:changes-requested thepastaclaw's latest review requested changes label Nov 18, 2026
@DCG-Claude
DCG-Claude force-pushed the backport-0.28-b011-src branch from 1892fe6 to 0368d06 Compare November 18, 2026 20:43
@thepastaclaw thepastaclaw removed the pastaclaw:changes-requested thepastaclaw's latest review requested changes label Nov 18, 2026
@DCG-Claude

Copy link
Copy Markdown
Collaborator Author

The blocking wallet-close double-delete is fixed by re-applying gui#835 alongside bitcoin#30659 (see the inline thread); the protocol.cpp suggestion is declined on its thread. The blockencodings follow-up matches upstream bitcoin#29752, which also stores bare transaction refs in the extra-txn ring, and GetInstanceHash() returns a cached hash for almost every transaction, so I left it unchanged. (folded into the bitcoin#30659 commit)


🤖 backportsys, on behalf of the Dash backport pipeline.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

At 0368d066ab28c05681060032f042d3610680ebe4, the restored GUI patch fixes the wallet-close double-delete, and the backport stack merges cleanly with the supplied develop tip. No blockers remain; the new findings concern repeated hashing during compact-block reconstruction and commit messages that should record the Dash adaptations. Lint, Cppcheck, ClangFormat, and ASan tests passed on this head; Windows and TSan builds and other build/test jobs were still pending.

🟡 3 suggestion(s) | 💬 1 nitpick(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

3 finding(s) not shown inline (the lines are not part of this PR's diff)

🟡 Suggestion: Document the restored gui#835 patch in the wallet backport
<commit:6798b1b4204>:1

The commit restores the Qt close-path changes from 20763f11014 (bitcoin-core/gui#835), which Dash reverted in 826221b298, but its adaptation notes don't mention the restoration. Record why the patches land together: RemoveWallet() now emits NotifyUnload(), so both Qt close actions must leave model deletion to the queued unload handler. This makes the dependency clear in git log without splitting the fix across commits.

source: gpt-6.2-sol (phase2-reviewer: general, backport-reviewer, dash-core-commit-history)

🟡 Suggestion: Record the replacement command-length assertion in the commit message
<commit:1cb05626d7f>:1

The adaptation notes say the MAKE_MSG compile-time check goes away and mention only the constructor assertion. The commit does remove the per-definition check, but it adds a replacement static_assert in protocol.cpp. Document both changes so the permanent record doesn't imply Dash dropped compile-time checking.

source: gpt-6.2-sol (phase2-reviewer: general, backport-reviewer, dash-core-commit-history)

💬 Nitpick: Label the compact-block backport as partial
<commit:3bf25c9f5c7>:1

The subject advertises type-safe Wtxid, but Dash takes the extra-transaction refactor and leaves GetShortID() typed as uint256. The body already explains the exclusion. Prefix the existing subject with partial, as in d2dd4fd1405, so git log --oneline shows the scope without losing the upstream title.

source: gpt-6.2-sol (phase2-reviewer: general, backport-reviewer, dash-core-commit-history)

Still open from earlier rounds (1)

  • 🟡 Suggestion: Keep the command-length check tied to the message definitions — src/protocol.cpp:14-16 (thread)
Follow-up candidates (optional) (1)

New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.

🟡 Suggestion: Keep the cached instance hash for compact-block extra transactions
src/blockencodings.cpp:142-146

Bitcoin's GetWitnessHash() reads a cached member. Dash's GetInstanceHash() also returns a cached hash for ordinary transactions, but it serializes and hashes the entire transaction for asset unlocks with a stable txid (payload version 2 or later). The old ring paid that cost once per insertion; the new scan pays it on every visit, before it knows whether the short ID matches. Retain the cached instance hash in the extra-transaction ring so reconstruction can reuse it without adding storage to every CTransaction.

source: gpt-6.2-sol (phase2-reviewer: general)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: backport-reviewer); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: dash-core-commit-history); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: backport-reviewer); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The bundle is broad, but its direct change to coin selection is a localized correction to change-cost accounting in SelectionResult::RecalculateWaste, not an intricate rewrite of selection behavior.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Code unchanged since the last final review (1892fe60): 1 new suggestion(s) listed as follow-up candidates, not posted inline
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — backport-reviewer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — dash-core-commit-history (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — backport-reviewer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — dash-core-commit-history (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `<commit:6798b1b4204>`:
- [SUGGESTION] <commit:6798b1b4204>:1: Document the restored gui#835 patch in the wallet backport
  The commit restores the Qt close-path changes from `20763f11014` (bitcoin-core/gui#835), which Dash reverted in `826221b298`, but its adaptation notes don't mention the restoration. Record why the patches land together: `RemoveWallet()` now emits `NotifyUnload()`, so both Qt close actions must leave model deletion to the queued unload handler. This makes the dependency clear in `git log` without splitting the fix across commits.

In `<commit:1cb05626d7f>`:
- [SUGGESTION] <commit:1cb05626d7f>:1: Record the replacement command-length assertion in the commit message
  The adaptation notes say the `MAKE_MSG` compile-time check goes away and mention only the constructor assertion. The commit does remove the per-definition check, but it adds a replacement `static_assert` in `protocol.cpp`. Document both changes so the permanent record doesn't imply Dash dropped compile-time checking.

In `<commit:3bf25c9f5c7>`:
- [NITPICK] <commit:3bf25c9f5c7>:1: Label the compact-block backport as partial
  The subject advertises type-safe `Wtxid`, but Dash takes the extra-transaction refactor and leaves `GetShortID()` typed as `uint256`. The body already explains the exclusion. Prefix the existing subject with `partial`, as in `d2dd4fd1405`, so `git log --oneline` shows the scope without losing the upstream title.

In `src/protocol.cpp`:
- [SUGGESTION] src/protocol.cpp:14-16: Keep the command-length check tied to the message definitions
  (carried; thread: https://github.com/dashpay/dash/pull/8168#discussion_r4620296858)

@thepastaclaw thepastaclaw added the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 18, 2026
@PastaPastaPasta

Copy link
Copy Markdown
Member

A note on bitcoin#29752 in this set: Bitcoin Core reverted it. bitcoin#33253 ("Revert compact block cache inefficiencies", merged 2025-08-28) contains b9300d8, a revert of the extra_txn simplification, because computing each extra transaction's hash on every compact block reconstruction was a measurable slowdown. In Dash the same scan would call GetInstanceHash() on every extra transaction, which re-serializes and hashes each v2 asset unlock.

#8209 backports bitcoin#33253 (for its other revert, of the vTxHashes change in bitcoin#28391) and currently treats the extra_txn revert as not applicable, since develop does not have bitcoin#29752. The two PRs also conflict in src/blockencodings.cpp and src/test/blockencodings_tests.cpp.

Two ways to keep this consistent:


🤖 Posted autonomously by Claude (claude-fable-5-2) on behalf of pasta.

@DCG-Claude

Copy link
Copy Markdown
Collaborator Author

A note on bitcoin#29752 in this set: Bitcoin Core reverted it. bitcoin#33253 ("Revert compact block cache inefficiencies", merged 2025-08-28) contains b9300d8

Dropping bitcoin#29752 from this batch. Its extra_txn commit (a8203e9) was reverted upstream by b9300d8 in bitcoin#33253, and it conflicts with #8209 in blockencodings.cpp and blockencodings_tests.cpp. No later commit in this batch touches those files. One caveat: the typesafe-Wtxid part of bitcoin#29752 was not reverted upstream, so when it is re-planned after #8209 lands it should come in together with b9300d8. Dropping bitcoin#29752 from this branch; it is being rewritten without it.


🤖 backportsys, on behalf of the Dash backport pipeline.

@DCG-Claude
DCG-Claude force-pushed the backport-0.28-b011-src branch from 0368d06 to 19ab299 Compare November 20, 2026 04:43
@DCG-Claude DCG-Claude changed the title backport: bitcoin#29421, bitcoin#29752, bitcoin#29419, bitcoin#29798, bitcoin#30494, bitcoin#30659, bitcoin#28366, bitcoin#30524 backport: bitcoin#29421, bitcoin#29419, bitcoin#29798, bitcoin#30494, bitcoin#30659, bitcoin#28366, bitcoin#30524 Nov 20, 2026
@DCG-Claude

Copy link
Copy Markdown
Collaborator Author

Branch rewritten at 19ab299a07 (7 backport(s)).


🤖 backportsys, on behalf of the Dash backport pipeline.

@thepastaclaw thepastaclaw removed the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 20, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

The seven backports at 19ab299 have no blocking correctness issues. The GUI deletion fix is present, the compact-block backport has been removed, and the supplied CI snapshot shows lint, ClangFormat, and Cppcheck passing while source builds remain pending. Three non-blocking documentation and maintenance suggestions remain.

🟡 2 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

2 finding(s) not shown inline (the lines are not part of this PR's diff)

🟡 Suggestion: Record the replacement command-length assertion in the commit message
<commit:907725c1a26>:1

The commit body says that Dash's MAKE_MSG and compile-time COMMAND_SIZE assertion go away, while this head adds a replacement static_assert over the constexpr message names in src/protocol.cpp:14-91. The PR description now documents the replacement, but the permanent commit message remains incomplete and can mislead readers into thinking only the runtime check survives. Amend the adaptation note to describe the retained compile-time check.

source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-sol (phase2-reviewer: general)

🟡 Suggestion: Document the restored gui#835 patch in the wallet backport
<commit:cd49c85532e>:1

The commit includes the walletcontroller.cpp and .h changes that restore gui#835: close paths now request node-side removal and the queued unload handler owns WalletModel deletion. The commit body lists the Bitcoin Core wallet changes and Dash call-site adaptations but does not explain why these additional Qt changes are present or that Dash had previously reverted them. Record the gui#835 restoration and its dependency on early NotifyUnload() so the unrelated-looking Qt changes remain explainable in git history.

source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-sol (phase2-reviewer: general)

Disputed — left to maintainers (1)

  • 🟡 Suggestion: Keep the command-length check tied to the message definitions — src/protocol.cpp:14-16 (thread)
Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: backport-reviewer); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The seven backports span several subsystems, but the coin-selection behavior change in src/wallet/coinselection.cpp is a localized fix to waste scoring when viable change has zero cost.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — backport-reviewer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — dash-core-commit-history (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `<commit:907725c1a26>`:
- [SUGGESTION] <commit:907725c1a26>:1: Record the replacement command-length assertion in the commit message
  The commit body says that Dash's `MAKE_MSG` and compile-time `COMMAND_SIZE` assertion go away, while this head adds a replacement `static_assert` over the constexpr message names in `src/protocol.cpp:14-91`. The PR description now documents the replacement, but the permanent commit message remains incomplete and can mislead readers into thinking only the runtime check survives. Amend the adaptation note to describe the retained compile-time check.

In `<commit:cd49c85532e>`:
- [SUGGESTION] <commit:cd49c85532e>:1: Document the restored gui#835 patch in the wallet backport
  The commit includes the `walletcontroller.cpp` and `.h` changes that restore gui#835: close paths now request node-side removal and the queued unload handler owns `WalletModel` deletion. The commit body lists the Bitcoin Core wallet changes and Dash call-site adaptations but does not explain why these additional Qt changes are present or that Dash had previously reverted them. Record the gui#835 restoration and its dependency on early `NotifyUnload()` so the unrelated-looking Qt changes remain explainable in git history.

@thepastaclaw thepastaclaw added the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 20, 2026
@PastaPastaPasta

Copy link
Copy Markdown
Member

The commit also re-applies bitcoin-core/gui#835, which Dash reverted in dash#6881, but the commit message does not say so.

this seems like a problem

@DCG-Claude
DCG-Claude force-pushed the backport-0.28-b011-src branch from 19ab299 to e96a87c Compare November 20, 2026 06:08
@DCG-Claude

Copy link
Copy Markdown
Collaborator Author

The commit also re-applies bitcoin-core/gui#835, which Dash reverted in dash#6881, but the commit message does not say so.

You're right that the src/qt/walletcontroller.{cpp,h} hunks aren't part of upstream bitcoin#30659. They are bitcoin-core/gui#835, which upstream merged as the fix for the closing-wallet crash bitcoin#30659 caused (bitcoin#30887). bitcoin#30659 now calls NotifyUnload() inside RemoveWallet(), so WalletModel::unload fires during wallet().remove() and runs removeAndDeleteWallet(), and the old closeWallet() then calls removeAndDeleteWallet() on the freed model a second time. dash#6881 reverted gui#835 because Dash didn't have this behaviour yet, and bitcoin#30659 is what adds it, so I kept the hunks and changed the subject to say gui#835 is included (happy to drop the hunks if you'd rather take gui#835 as its own backport). (the bitcoin#30659 commit is now titled Merge bitcoin/bitcoin#30659: wallet: fix UnloadWallet thread safety assumptions (incl. bitcoin-core/gui#835, re-applying what dash#6881 reverted))


🤖 backportsys, on behalf of the Dash backport pipeline.

@thepastaclaw thepastaclaw added pastaclaw:approved thepastaclaw's latest review approved this PR and removed pastaclaw:approved thepastaclaw's latest review approved this PR labels Nov 20, 2026
PastaPastaPasta added a commit that referenced this pull request Nov 20, 2026
…itcoin#29343, bitcoin#33253

ca4b09c Merge bitcoin#29343: test: fix wallet_import_rescan unrounded minimum amount (pasta)
631fae3 Merge bitcoin#29283: test: ensure output is large enough to pay for its fees (pasta)
607831b test: drop the label from the ranged descriptor import in wallet_rescan_unconfirmed (pasta)
902cb79 Merge bitcoin#33253: Revert compact block cache inefficiencies (pasta)
5c0c125 Merge bitcoin#29179: test: wallet rescan with reorged parent + IsFromMe child in mempool (pasta)
7b22bea Merge bitcoin#28391: refactor: Simplify CTxMempool/BlockAssembler fields, remove some external mapTx access (pasta)

Pull request description:

  ## Issue being fixed or feature implemented

  When the wallet reads the mempool, it can record an unconfirmed payment to itself and miss the unconfirmed transaction that spends it, so the spent output shows as unspent until the spend is mined. `ChainImpl::requestMempoolTransactions()` walks `mapTx` through its txid-hashed index, which can hand the wallet a child before its parent. A child that pays only external addresses is not recognised when it arrives first, and nothing revisits it. Every wallet load and every rescan without an end height replays the mempool this way.

  Bitcoin Core fixed the order in bitcoin#28391 (`requestMempoolTransactions()` iterates the new `CTxMemPool::entryAll()`, sorted parents first) and added regression tests in bitcoin#29179. It later reverted the compact block part of bitcoin#28391 in bitcoin#33253 because it slowed block reconstruction, so that revert is included here too.

  Fixes #8208

  ## What was done?

  **bitcoin#28391** (refactor: Simplify CTxMempool/BlockAssembler fields, remove some external mapTx access), whole. It adds `CTxMemPool::entryAll()` and `GetEntry()`, makes `vTxHashes` a vector of transaction refs (`txns_randomized`; bitcoin#33253 below turns it back into cached `(instance hash, entry)` pairs), makes `lockPoints` mutable, turns `BlockAssembler::inBlock`/`failedTx` into txid sets, and replaces outside `mapTx` access in RPC, validation and tests. Dash adaptations:
  - Dash has no `Txid` type (bitcoin#28107), so `GetEntry()`, `inBlock` and `failedTx` use `uint256`.
  - Compact block reconstruction computes short ids from `GetInstanceHash()`, which is what Dash's `vTxHashes` held, instead of `GetWitnessHash()`.
  - `ReplaceAssetUnlockInstance()` swaps the fresh asset-unlock instance into `txns_randomized` (with bitcoin#33253 below, it refreshes the cached instance hash instead).
  - Dash's ProUpServTx-ordering and invalid-package paths in `addPackageTxs()` use `inBlock`/`failedTx` as txid sets as well.
  - `MaybeUpdateMempoolForReorg()` and `AcceptPackage()` use Dash's `exists(uint256)` and keep Dash's single already-in-mempool case.
  - `checkChainLimits()` returns `CheckPackageLimits()`'s result directly, completing the hunk the partial bitcoin#28863 backport deferred.
  - Non-verbose `getrawmempool` iterates `entryAll()` as upstream bitcoin#29260 does; Dash's bitcoin#29260 backport used `mapTx` because `entryAll()` did not exist yet.
  - `DynamicMemoryUsage()` keeps Dash's 12-pointer `mapTx` estimate.

  Not applicable to Dash: the `policy/rbf.cpp` hunk (no RBF) and the `miniminer_tests.cpp` hunk (the bump-fee-only mini miner, bitcoin#27021, was not adopted).

  **bitcoin#29179** (test: wallet rescan with reorged parent + IsFromMe child in mempool), whole: new `wallet_rescan_unconfirmed.py` and a reorged-parent + child case in `wallet_import_rescan.py`. Dash adaptations:
  - `wallet_import_rescan.py` imports only `ADDRESS_BCRT1_UNSPENDABLE`, since Dash's copy has no segwit address-type variants.
  - `wallet_import_rescan.py` also sets the framework's `self.mocktime` when it jumps past the rescan window. Dash's `sync_mempools()` bumps mocktime from `self.mocktime`, so otherwise the new `sync_mempools()` call moved the node clocks back two hours and the block mined after it was rejected as `time-too-new`.

  **bitcoin#33253** (Revert compact block cache inefficiencies), whole. bitcoin#28391 turned the mempool's cached `(hash, entry)` vector into a vector of transaction refs. Compact block reconstruction scans that vector for every compact block. With plain refs it has to dereference every mempool transaction to get its hash, and in Dash it calls `CTransaction::GetInstanceHash()` on each one, which serializes and hashes every version 2 or later asset unlock even when nothing matches. Before bitcoin#28391 the scan read cached hashes and touched an entry only after a short-id match. bitcoin#33253 restores the cached pairs (keeping the `txns_randomized` name) and adds a reconstruction benchmark. `entryAll()`, `GetEntry()` and the parent-first `requestMempoolTransactions()` from bitcoin#28391 are unaffected. Dash adaptations:
  - `txns_randomized` caches each entry's instance hash, which Dash computes short ids from and which `vTxHashes` held before, as `pair<uint256, txiter>` (no `Wtxid` type).
  - `ReplaceAssetUnlockInstance()` refreshes the cached hash when it swaps in a re-signed asset unlock, as it did before bitcoin#28391. `mempool_pending_asset_unlock_amount` (in `evo_assetlocks_tests`) now checks that compact block reconstruction finds the refreshed instance in the mempool and treats the replaced one as missing.
  - The `BlockEncoding*` benchmarks use `CTxMemPool::addUnchecked()`, a seeded `FastRandomContext` and Dash's `CBlockHeaderAndShortTxIDs` constructor. They build witness-free transactions and key extra transactions by instance hash.
  - The `InitData()` comment from the `extra_txn` revert names the instance hash instead of the wtxid.

  Not applicable to Dash: the `extra_txn` revert (b9300d8) undoes bitcoin#29752, which Dash never took. `extra_txn` and `vExtraTxnForCompact` already hold `<hash, CTransactionRef>` pairs, so only the comment applies. #8168 proposes bitcoin#29752; if that merges first, this revert applies and will be added here.

  **bitcoin#31514, test hunk only.** `wallet_rescan_unconfirmed.py` (added by bitcoin#29179) no longer passes a `label` on its ranged descriptor import, matching the change bitcoin#31514 made to the test. Bitcoin Core rejects that label since bitcoin#31514. Dash still accepts it because its `importdescriptors` only rejects a label when `range` is given explicitly, so the test passes either way. The `importdescriptors` change itself is not part of this PR, and this commit is not a backport of bitcoin#31514.

  **bitcoin#29283 and bitcoin#29343** (test: ensure output is large enough to pay for its fees; test: fix wallet_import_rescan unrounded minimum amount), whole. Follow-ups to the `wallet_import_rescan.py` case bitcoin#29179 adds: the parent's amount gets a fee-aware minimum, so the child that sweeps it with `subtract_fee_from_outputs` can always pay its fee. Upstream saw this fail intermittently. No Dash adaptation beyond the import list.

  No prerequisites were needed beyond what develop already has.

  ## How Has This Been Tested?

  macOS arm64 Debug build with `-DWERROR=ON`, tests and bench enabled.

  - Unit tests: full `test_dash` suite passes.
  - Cached-hash refresh: with the `ReplaceAssetUnlockInstance()` refresh of the cached hash removed, both new reconstruction checks in `evo_assetlocks_tests/mempool_pending_asset_unlock_amount` fail. With it, they pass.
  - Benchmark: `bench_dash -filter='BlockEncoding.*' -min-time=1000` runs all three `BlockEncoding*` benchmarks to completion. Timings from this Debug `-O0` build were not compared against the pre-revert code.
  - New tests fail without the fix (checked before bitcoin#33253 was added): with `requestMempoolTransactions()` switched back to iterating `mapTx`, `wallet_rescan_unconfirmed.py --descriptors` failed 10 of 10 runs and `wallet_import_rescan.py --legacy-wallet` failed 4 of 4. Every failure was `gettransaction(<child>)`: "Invalid or non-wallet transaction id". With the fix, both pass.
  - Functional tests passing after bitcoin#33253 and the bitcoin#31514 test hunk: `p2p_compactblocks`, `p2p_compactblocks_blocksonly`, `p2p_compactblocks_hb` (`--v1transport` and `--v2transport`), `feature_asset_locks`, `feature_asset_locks_v24`, `wallet_rescan_unconfirmed.py --descriptors`, `wallet_import_rescan.py --legacy-wallet`, `mempool_packages`, `mining_basic`.
  - After bitcoin#29283 and bitcoin#29343 (test-only): `wallet_import_rescan.py --legacy-wallet` passes.
  - Functional tests passing before bitcoin#33253 was added: `wallet_rescan_unconfirmed.py --descriptors`, `wallet_import_rescan.py --legacy-wallet`, `wallet_basic.py` (both wallet types), `wallet_abandonconflict.py` (both), `wallet_resendwallettransactions.py` (both), `mempool_accept`, `mempool_limit`, `mempool_packages`, `mempool_package_limits`, `mempool_package_onemore`, `mempool_persist --descriptors`, `mempool_reorg`, `mempool_resurrect`, `mempool_spend_coinbase`, `mempool_unbroadcast`, `mempool_updatefromblock`, `mempool_expiry`, `mempool_sigoplimit`, `rpc_mempool_info`, `mining_basic`, `mining_prioritisetransaction`, `feature_block`, `p2p_compactblocks`, `p2p_compactblocks_blocksonly`, `p2p_compactblocks_hb --v2transport`, `rpc_rawtransaction --legacy-wallet`, `feature_asset_locks`, `feature_asset_locks_v24`, `feature_llmq_is_cl_conflicts`, `p2p_instantsend`. `mempool_compatibility.py` was skipped (no previous-release binaries).
  - Lint: `lint-circular-dependencies.py`, `lint-includes.py` and `lint-whitespace.py` pass; flake8 via `lint-python.py` is clean on the changed Python files. clang-format-diff is clean on the changed C++ except the new `src/bench/blockencodings.cpp`, which keeps upstream's layout.

  ## Breaking Changes

  None. The order of mempool listings changes, and it was never specified:

  - Verbose `getrawmempool` and `/rest/mempool/contents` now list entries sorted by ancestor count, then fee score, as in Bitcoin Core, instead of in hash-index order.
  - Non-verbose `getrawmempool` returns to that same order, which it had up to v23.x. Dash's bitcoin#29260 backport (in v24.0.0) switched it to hash-index order because `entryAll()` did not exist yet.

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(if you have permission to set one)_

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

Top commit has no ACKs.

Tree-SHA512: c76bf23521afd929f0f0e9a3b42165a2611a26c4c3eca9d040387e74061c1d9c36bdf7c1f734227085fe97ebc8f5b461de8e47ff707f164eda6bf69319a5974d
Comment thread src/protocol.cpp Outdated
NetMsgType::DSSTATUSUPDATE,
NetMsgType::DSTX,
NetMsgType::DSQUEUE,
NetMsgType::SENDDSQUEUE,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why re-ordered? Seems unrelated.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, the reorder was an unintended side effect of turning the list into the compile-time size check. SENDDSQUEUE is back after GETSPORKS, so the list order matches the base and ALL_NET_MESSAGE_TYPES in protocol.h. (folded into the bitcoin#29421 commit)


🤖 backportsys, on behalf of the Dash backport pipeline.

Comment thread src/protocol.cpp
NetMsgType::GETCFCHECKPT,
NetMsgType::CFCHECKPT,
NetMsgType::SENDTXRCNCL,
// Dash message types

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why comment removed? Seems unrelated

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, the comments should not have been removed. The '// Dash message types' comment and the NOTE about not including unimplemented messages are restored in the list. (folded into the bitcoin#29421 commit)


🤖 backportsys, on behalf of the Dash backport pipeline.

…ile time constant

b3efb48 protocol: make message types constexpr (Vasil Dimov)
2fa9de0 net: make the list of known message types a compile time constant (Vasil Dimov)

Pull request description:

  Turn the `std::vector` to `std::array` because it is cheaper and allows us to have the number of the messages as a compile time constant: `ALL_NET_MESSAGE_TYPES.size()` which can be used in future code to build other `std::array`s with that size.

  ---

  This change is part of bitcoin#29418 but it makes sense on its own and would be good to have it, regardless of the fate of bitcoin#29418. Also, if this is merged, that would reduce the size of bitcoin#29418, thus the current standalone PR.

ACKs for top commit:
  achow101:
    ACK b3efb48
  jonatack:
    ACK b3efb48
  maflcko:
    utACK b3efb48 🎊
  willcl-ark:
    ACK b3efb48

Tree-SHA512: 6d3860c138c64514ebab13d97ea67893e2d346dfac30a48c3d9bc769a1970407375ea4170afdb522411ced306a14a9af4eede99e964d1fb1ea3efff5d5eb57af

Dash adaptations:
- src/protocol.h: no FEEFILTER/WTXIDRELAY constants or ALL_NET_MESSAGE_TYPES entries; Dash does not implement feefilter or wtxidrelay
- src/protocol.h: Dash message types (SPORK..PLATFORMBAN) become inline constexpr with their existing strings (e.g. DSACCEPT{"dsa"}) and stay in ALL_NET_MESSAGE_TYPES in Dash's order
- src/protocol.h: adds #include <array> for std::array/std::to_array; upstream's protocol.h already had this include
- src/protocol.cpp: Dash's MAKE_MSG macro and its compile-time COMMAND_SIZE static_assert go away with the definitions; the runtime assert in CMessageHeader's constructor still applies
- src/protocol.cpp: keeps Dash's blocks-only message list and NetMessageViolatesBlocksOnly(); its comment now refers to ALL_NET_MESSAGE_TYPES in protocol.h
- src/net.cpp: Dash-only CalculateNumConnectionsChangedStats() loops now use ALL_NET_MESSAGE_TYPES instead of getAllNetMessageTypes()
- src/net_processing.cpp: Dash-only extension-message lookup in ProcessMessage() now uses ALL_NET_MESSAGE_TYPES instead of getAllNetMessageTypes()
- test/fuzz/test_runner.py: Dash maps NetMsgType names to message strings by parsing the protocol.h constexpr definitions instead of lowercasing (DSACCEPT is "dsa")
- src/test/fuzz/p2p_transport_serialization.cpp: g_all_messages stays outside an anonymous namespace; Dash's version of this file never had that namespace
…ing.cpp

b0344c2 logging: remove unused BCLog::UTIL (Vasil Dimov)
d3b3af9 log: deduplicate category names and improve logging.cpp (Vasil Dimov)

Pull request description:

  The code in `logging.cpp` needs to:
  * Get the category name given the flag (e.g. `BCLog::PRUNE` -> `"prune"`)
  * Get the flag given the category name (e.g. `"prune"` -> `BCLog::PRUNE`)
  * Get the list of category names sorted in alphabetical order

  Achieve this by using the proper std containers. The result is
  * less code (the diff of the first commit is +62 / -129)
  * faster code (to linear search and no copy+sort)
  * more maintainable code (the categories are no longer duplicated in `LogCategories[]` and `LogCategoryToStr()`)

  This behavior is preserved:
  `BCLog::NONE` -> `""` (lookup by `LogCategoryToStr()`)
  `""` -> `BCLog::ALL` (lookup by `GetLogCategory("")`)

  ---

  Also remove unused `BCLog::UTIL`.

  ---

  These changes (modulo the `BCLog::UTIL` removal) are part of bitcoin#29415 but they make sense on their own and would be good to have them, regardless of the fate of bitcoin#29415. Also, if this is merged, that would reduce the size of bitcoin#29415, thus the current standalone PR.

ACKs for top commit:
  davidgumberg:
    crACK bitcoin@b0344c2
  pinheadmz:
    ACK b0344c2
  ryanofsky:
    Code review ACK b0344c2. Nice cleanup! Having to maintain multiple copies of the same mapping seemed messy and a like a possible footgun. I checked old and new mappings in both directions and confirmed no behavior should be changing.

Tree-SHA512: 57f87a090932f9b33dc8e075d1855dba9b71a3243a0758511745483dec2d9c46d3b532eadab297e78164c9b7caba370986ee380696a45f0778a841082f8e21a7

Dash adaptations:
- src/logging.cpp: LOG_CATEGORIES_BY_STR uses Dash's enum names BCLog::BENCHMARK and BCLog::RANDOM (Dash never renamed them to BENCH/RAND); the strings "bench"/"rand" are unchanged
- src/logging.cpp: Dash categories (chainlocks, gobject, instantsend, llmq, llmq-dkg, llmq-sigs, mnpayments, mnsync, coinjoin, spork, netconn, creditpool, ehf, dash) move into LOG_CATEGORIES_BY_STR in string->flag form
- src/logging.cpp: LOG_CATEGORIES_BY_FLAG also maps NET_NETCONN to "net|netconn", which Dash's removed switch returned; it is not a parseable category so it cannot go in the string map
- src/logging.cpp: LogCategoriesList keeps Dash's enabled_only parameter and its exclusion of the BCLog::DASH group flag, now looping over LOG_CATEGORIES_BY_STR
- src/logging.h: UTIL removal (bitcoin commit b0344c2) only renumbers BLOCKSTORAGE..TXPACKAGES to bits 25..28; Dash never had UTIL, and Dash's 64-bit flags and ALL = ~(uint64_t)0 are kept
a7432dd logging: clarify -debug and -debugexclude descriptions (Anthony Towns)
74dd33c rpc: make logging method reject "0" category and correct the help text (Vasil Dimov)
8c6f3bf logging, refactor: minor encapsulation improvement and use BCLog::NONE instead of 0 (Vasil Dimov)
160706a logging, refactor: make category special cases explicit (Ryan Ofsky)

Pull request description:

  * Move special cases from `LOG_CATEGORIES_BY_STR` to `GetLogCategory()` (suggested [here](bitcoin#29419 (comment))).

  * Remove `"none"` and `"0"` from RPC `logging` help because that help text was wrong. `"none"` resulted in an error and `"0"` was ignored itself (contrary to what the help text suggested).

  * Remove unused `LOG_CATEGORIES_BY_STR[""]` (suggested [here](bitcoin#29419 (comment))).

  This is a followup to bitcoin#29419, addressing leftover suggestions + more.

ACKs for top commit:
  LarryRuane:
    ACK a7432dd
  ryanofsky:
    Code review ACK a7432dd. Only changes since last review are removing dead if statement and adding AJ's suggested -debug and -debugexclude help improvements, which look accurate and much more clear.

Tree-SHA512: 41b997b06fccdb4c1d31f57d4752c83caa744cb3280276a337ef4a9b7012a04eb945071db6b8fad24c6a6cf8761f2f800fe6d8f3d8836f5b39c25e4f11c85bf0

Dash adaptations:
- src/logging.h: m_categories keeps Dash's std::atomic<uint64_t> type (Dash has 64-bit LogFlags); only the initializer becomes BCLog::NONE as upstream
- src/logging.cpp: LOG_CATEGORIES_BY_STR keeps Dash's plain std::map (no std::less<>, which comes from a separate string_view PR) and its Dash categories; only the 0/""/1/all entries are removed
- src/logging.cpp: LogCategoriesList keeps Dash's enabled_only filter and BCLog::DASH exclusion; only the now-redundant NONE/ALL checks are dropped
- src/rpc/node.cpp: removes only the "none"/"0" help line; Dash's "dash" and "deactivate all" help lines stay
…arget

dcb4ec9 fuzz: reduce keypool size in scriptpubkeyman target (brunoerg)

Pull request description:

  Fixes bitcoin#30476

  This PR reduces keypool size in scriptpubkeyman fuzz target to avoid spend a lot of time in `TopUp` (which is obviously called by many spkm functions).

  For reference:

  This PR:
  ```
  INFO: Running with entropic power schedule (0xFF, 100).
  INFO: Seed: 1845055748
  INFO: Loaded 1 modules   (1225616 inline 8-bit counters): 1225616 [0x106346fe0, 0x106472370),
  INFO: Loaded 1 PC tables (1225616 PCs): 1225616 [0x106472370,0x107725c70),
  ./src/test/fuzz/fuzz: Running 1 inputs 10 time(s) each.
  Running: ./qa-assets/fuzz_seed_corpus/scriptpubkeyman/c9b8928cecb1edc192fb2d5816b4b7878cdfcf50
  Executed ./qa-assets/fuzz_seed_corpus/scriptpubkeyman/c9b8928cecb1edc192fb2d5816b4b7878cdfcf50 in 250 ms
  ```

  Master:
  ```
  INFO: Running with entropic power schedule (0xFF, 100).
  INFO: Seed: 2004906948
  INFO: Loaded 1 modules   (1225603 inline 8-bit counters): 1225603 [0x104196f80, 0x1042c2303),
  INFO: Loaded 1 PC tables (1225603 PCs): 1225603 [0x1042c2308,0x105575b38),
  ./src/test/fuzz/fuzz: Running 1 inputs 10 time(s) each.
  Running: ./qa-assets/fuzz_seed_corpus/scriptpubkeyman/c9b8928cecb1edc192fb2d5816b4b7878cdfcf50
  Executed ./qa-assets/fuzz_seed_corpus/scriptpubkeyman/c9b8928cecb1edc192fb2d5816b4b7878cdfcf50 in 21016 ms
  ```

ACKs for top commit:
  maflcko:
    review ACK dcb4ec9
  dergoegge:
    utACK dcb4ec9

Tree-SHA512: d818b228d5f1dd0d5c665d8e54cf5dd8e378604039eaac114fc34366ece4420b9b2519d898f2dc2410960b873f0b91bbad4a534a35658477aed6ef48f3458137
…ns (incl. bitcoin-core/gui#835, re-applying what dash#6881 reverted)

f550a8e Rename ReleaseWallet to FlushAndDeleteWallet (furszy)
64e736d wallet: WaitForDeleteWallet, do not expect thread safety (Ryan Ofsky)
8872b4a wallet: rename UnloadWallet to WaitForDeleteWallet (furszy)
5d15485 wallet: unload, notify GUI as soon as possible (furszy)

Pull request description:

  Coming from bitcoin#29073.

  Applied ryanofsky suggested changes on bitcoin#29073 (comment) with few modifications coming from bitcoin#18338 (comment).

  The only point I did not tackle from bitcoin#18338 (comment) is:

  > * Move log print and flush out of ReleaseWallet into CWallet destructor

  Because it would mean every `CWallet` object would flush data to disk during destruction. Which is not necessary for wallet tool utilities and unit tests.

ACKs for top commit:
  achow101:
    ACK f550a8e
  ryanofsky:
    Code review ACK f550a8e. Just a simple rename since last review
  ismaelsadeeq:
    Re-ACK f550a8e

Tree-SHA512: e2eb69bf36883c514f601f4838ae6a41113996b9559abf8dc2b46e16bbcdad401195ac0f2b9d1fb55a10e78bb8ea9953788a168c80474e3f101350d208cb3bd2

Dash adaptations:
- src/wallet/wallet.cpp: RemoveWallet() adds NotifyUnload() after the wallets_mutex block, ahead of Dash's CoinJoin loader RemoveWallet() call, which is kept
- src/wallet/rpc/wallet.cpp: unloadwallet keeps Dash's call position after PushWarnings (wallet still needed for the walletwarningfield check); only renamed to WaitForDeleteWallet
- src/wallet/test/fuzz/notifications.cpp: Dash-only UnloadWallet() call in ~FuzzedWallet renamed to WaitForDeleteWallet (upstream's file has no such call)
- src/wallet/wallet.cpp: Dash-only comment in the MigrateLegacyToDescriptor failure cleanup now names WaitForDeleteWallet() instead of UnloadWallet()
bd34dd8 Use `exact_target` shorthand in coinselector_tests (Murch)
7aa7e30 Fold GetSelectionWaste() into ComputeAndSetWaste() (Murch)

Pull request description:

  PR bitcoin#26152 moved waste calculation into SelectionResult to be able to correct the waste score on basis of the bump_fee_group_discount for overlapping ancestries. This left two functions with largely overlapping purpose, where one was simply a wrapper of the other. This PR cleans up the overlap, and fixes the double-meaning of `change_cost` where the `GetChange()` function assumed that no change was created when `change_cost` was set to 0. This behavior was exploited in a bunch of tests, but is problematic, because a `change_cost` of 0 is permitted with custom settings for feerate and discard_feerate (i.e. when they’re both 0).

ACKs for top commit:
  achow101:
    ACK bd34dd8
  furszy:
    Code ACK bd34dd8
  ismaelsadeeq:
    Code Review ACK bd34dd8

Tree-SHA512: 83a2688d45d719dc61a64b5180fe136107faccf401a59df65245c05d701748a03e85ed56fde8c9b7ef39a3ab54374dd3718c559bda5b3f55dafedfd7fed25161

Dash adaptations:
- src/wallet/coinselection.{h,cpp}: removes Dash's free GetSelectionWaste(inputs, ...) (Dash never made it a member, bitcoin#26152) and folds it into RecalculateWaste()
- src/wallet/coinselection.{h,cpp}: RecalculateWaste() and its doc omit bump_fee_group_discount and SetBumpFeeDiscount, which come from bitcoin#26152 that Dash declined
- src/wallet/spend.cpp: renames ComputeAndSetWaste in Dash's per-algorithm knapsack/SRD waste calls (Dash has no bitcoin#26152 post-loop), keeping Dash's errors.front() return
- src/bench/coin_selection.cpp: keeps Dash's AttemptSelection(wallet, ...) signature, takes upstream's new feerates and 1002.99 COIN target
- src/wallet/test/coinselector_tests.cpp: waste_test fills a CoinSet and calls SelectionResult::AddInputs, since the fee-taking add_coin(SelectionResult&) overload is from declined bitcoin#26152
- src/wallet/test/coinselector_tests.cpp: check_max_weight uses max_weight = MAX_STANDARD_TX_SIZE - (tx_noinputs_size + change_output_size), since Dash has no witness scaling

Not applicable to Dash (intentionally omitted):
- src/wallet/test/coinselector_tests.cpp: bump_fee_test renames only touch a test that bitcoin#26152 (declined by Dash) added for ApplyBumpFee/SetBumpFeeDiscount, which Dash does not have
- src/wallet/spend.cpp: rename inside bitcoin#26152's combined-bump-fee loop in ChooseSelectionResult; Dash never took that loop, so the rename is applied to Dash's per-algorithm calls
fa5755b doc: rpc: Use "output script" consistently (2/2) (MarcoFalke)

Pull request description:

  Small follow-up to bitcoin#30408 to fixup the RPCs that were forgotten.

ACKs for top commit:
  theStack:
    lgtm ACK fa5755b

Tree-SHA512: f1fc0aabb59017da216d6fe0f08a2274336d04db332ad6ce3d9608cd6f03667be1c76423f24a489ac8e7d536011a129dca752ab64b4621b7bc1d4d53f68602e4

Dash adaptations:
- src/rpc/blockchain.cpp: scantxoutset comment keeps Dash's example address XcJSEb79...; combo() help keeps Dash's 'P2PK and P2PKH' wording
- src/rpc/output_script.cpp: validateaddress scriptPubKey help keeps Dash's DIP-18 Platform sentence; deriveaddresses raw() line keeps Dash's narrower column width (no wpkh/tr examples)
- src/wallet/rpc/addresses.cpp: wording change applied around Dash's isplatform result field
- src/wallet/rpc/transactions.cpp: wording change applied in Dash's TransactionDescriptionString (keeps DS/to fields, no bip125-replaceable)

Not applicable to Dash (intentionally omitted):
- src/rpc/rawtransaction.cpp: analyzepsbt 'witnessscript' help line (witness script wording); Dash has no segwit and no such result field
- src/wallet/rpc/coins.cpp: listunspent 'witnessScript' help line (P2WSH wording); Dash has no segwit and no such result field
@DCG-Claude
DCG-Claude force-pushed the backport-0.28-b011-src branch from e96a87c to 93c1660 Compare November 26, 2026 19:09
@thepastaclaw thepastaclaw removed the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 26, 2026

@knst knst left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 93c1660

@knst
knst merged commit 42e2c2d into dashpay:develop Nov 26, 2026
17 of 18 checks passed
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.

4 participants