Skip to content

backport: v0.26 bitcoin#25862, bitcoin#27499 - #84

Open
DCG-Claude wants to merge 2 commits into
developfrom
backport-0.26-b064-src-node
Open

DCG-Claude wants to merge 2 commits into
developfrom
backport-0.26-b064-src-node

Conversation

@DCG-Claude

@DCG-Claude DCG-Claude commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Automated Bitcoin Core v0.26 backports, batch backport-0.26-b064-src-node.

upstream commit gates notes
bitcoin#25862 d110416258 pick:pass build:pass tests:pass mech:warn tree:pass verify:pass Backports bitcoin#25862 in full: DBParams/DBOptions and CoinsViewOptions replace the gArgs reads in dbwrapper.cpp and tx
bitcoin#27499 8b9cea6bd0 pick:pass build:pass tests:pass mech:warn tree:pass verify:pass Backports bitcoin#27499: PeerManager now takes a PeerManager::Options struct filled by node::ApplyArgsManOptions, so it

Failed gates (not included):

Provenance

Each commit passed: cherry-pick (adapted by an Opus lane only where conflicts existed), build, touched tests, a mechanical diff-of-diffs check (every upstream hunk landed; no added line without an upstream counterpart), and an independent Opus verification lane where anything was adapted. Gate rows and lane artifacts are in the backportsys DB.

@DCG-Claude

Copy link
Copy Markdown
Collaborator Author

CI failed at 807c261 on thepastaclaw/dash: Lint / Run linters

The lint failure was a new circular dependency, dbwrapper -> node/database_args -> dbwrapper. It came from the Dash-only adaptation in bitcoin#25862 that made util::MakeDbWrapper call node::ReadDatabaseArgs from dbwrapper.h. I removed the <node/database_args.h> include and now set DBOptions{.force_compact = gArgs.GetBoolArg("-forcecompactdb", false)} directly, so -forcecompactdb still applies to Dash's databases as it did before the backport. lint-circular-dependencies.py now passes locally and a syntax-only compile of dbwrapper.h with MakeDbWrapper succeeds; I did not run a full build. (folded into the bitcoin#25862 commit)


🤖 backportsys, on behalf of the Dash backport pipeline.

@DCG-Claude

Copy link
Copy Markdown
Collaborator Author

CI failed at 9bc7bd5 on thepastaclaw/dash: linux64_asan-test / Test source

I tried a fix but it failed local gates in bitcoin#28148 (verify: Upstream bitcoin#28148 does not touch the -maxorphantxsize handling. This replaces the std::max(int64_t{0}, *value) line kept from the parent commit with a new overflow clamp, which changes behaviour and is not in upstream or in the commit's declared Dash adaptations.; Added only to support the invented std::clamp change. Upstream adds no includes.; Added only to support the invented std::numeric_). bitcoin#28148 has had its repair lane and is being dropped from this branch.


🤖 backportsys, on behalf of the Dash backport pipeline.

@DCG-Claude DCG-Claude changed the title backport: v0.26 bitcoin#25862, bitcoin#27499, bitcoin#28148 backport: v0.26 bitcoin#25862, bitcoin#27499 Sep 28, 2026
@DCG-Claude
DCG-Claude force-pushed the backport-0.26-b064-src-node branch from 9bc7bd5 to e796595 Compare September 28, 2026 05:14
@DCG-Claude

Copy link
Copy Markdown
Collaborator Author

Branch rewritten at e796595008 (2 backport(s)).


🤖 backportsys, on behalf of the Dash backport pipeline.

…rapper and txdb

aadd7c5 refactor, validation: Add ChainstateManagerOpts db options (Ryan Ofsky)
0352258 refactor, txdb: Use DBParams struct in CBlockTreeDB (Ryan Ofsky)
c00fa1a refactor, txdb: Add CoinsViewOptions struct (Ryan Ofsky)
2eaeded refactor, dbwrapper: Add DBParams and DBOptions structs (Ryan Ofsky)

Pull request description:

  Code in the libbitcoin_kernel library should not be calling `ArgsManager` methods or trying to read options from the command line. Instead it should just get options values from simple structs and function arguments that are passed in externally. This PR removes `gArgs` accesses from `dbwrapper` and `txdb` modules by defining appropriate options structs, and is a followup to PR's bitcoin#25290 bitcoin#25487 bitcoin#25527 which remove other `ArgsManager` calls from kernel modules.

  This PR does not change behavior in any way. It is a simpler alternative to bitcoin#25623 because the only thing it does is remove `gArgs` references from kernel code. It avoids other unnecessary changes like adding options to the kernel API (they can be added separately later).

ACKs for top commit:
  TheCharlatan:
    Code review ACK aadd7c5
  achow101:
    ACK aadd7c5
  furszy:
    diff ACK aadd7c5

Tree-SHA512: 46dfd5d99ab3110492e7bba97a87122c831b8344caaf7dd2ebdb6e0ad6aa9174d4d1832d6f3a7465eda9294fe50defaa3c000afbbddc4e72838687df09a63ffd

Dash adaptations:
- src/kernel/chainstatemanager_opts.h: only `fs::path datadir;` added; upstream's conflict context also carried `adjusted_time_callback`, which Dash already removed with bitcoin#28956, so it is not re-added
- src/bitcoin-chainstate.cpp, src/init.cpp (AppInitMain), src/test/util/setup_common.cpp, src/test/validation_chainstatemanager_tests.cpp: added `.datadir = ...GetDataDirNet()` without the `.adjusted_time_callback` line from the upstream context, for the same reason
- src/validation.cpp: new CoinsViews(DBParams, CoinsViewOptions) ctor placed after Dash's GetBlockSubsidy(const CBlockIndex*, ...), which is kept
- src/dbwrapper.h: DBOptions/DBParams added after Dash's CharCast helper, which is kept
- src/test/dbwrapper_tests.cpp: unicodepath test keeps Dash's '∋' path name (Dash replaces '₿') and only takes the DBParams constructor change
- src/test/util/setup_common.cpp: the CBlockTreeDB(DBParams{...}) change sits next to Dash's mn_sync/clhandler setup, which is kept
- src/dbwrapper.h: Dash-only util::MakeDbWrapper (used by evodb, llmq recsigdb/quorumdb/dkgdb and isdb) now builds DBParams; its options come from node::ReadDatabaseArgs(gArgs, ...), like upstream's BaseIndex::DB, so -forcecompactdb still applies to Dash's databases. Added includes for <node/database_args.h> and <util/system.h>
- src/txdb.cpp: Dash-only CBlockTreeDB::MigrateOldIndexData opens chainstate/timestampindex/spentindex/addressindex CDBWrappers; converted to DBParams{.path, .cache_bytes = 0} (same memory/wipe/obfuscate values as before)
- src/node/chainstate.cpp: Dash-only RecoverSnapshotCleanup's CCoinsViewDB converted to {{.path = normal, .cache_bytes = 1 << 20, .obfuscate = true}, {}}; obfuscate=true is kept because the old CCoinsViewDB always set it and upstream now leaves it to the caller
- src/Makefile.am: node/database_args.cpp added to libdashkernel_la_SOURCES, because Dash's kernel lib includes index/base.cpp (upstream's does not), which now calls node::ReadDatabaseArgs
…rom gArgs

23c7b51 [net processing] Move -capturemessages to PeerManager::Options (dergoegge)
bd59bda [net processing] Move -blockreconstructionextratxn to PeerManager::Options (dergoegge)
567c4e0 [net processing] Move -maxorphantx to PeerManager::Options (dergoegge)
fa9e6d8 [net processing] Move -txreconciliation to PeerManager::Options (dergoegge)
4cfb7b9 [net processing] Use ignore_incoming_txs from m_opts (dergoegge)
8b87725 [net processing] Introduce PeerManager options (dergoegge)

Pull request description:

  This PR decouples `PeerManager` from our global args manager by introducing `PeerManager::Options`.

ACKs for top commit:
  stickies-v:
    re-ACK 23c7b51
  TheCharlatan:
    ACK 23c7b51

Tree-SHA512: cd807b36ec018010e11935d3539fa7ed5015fdfb531d13a042a65b54ee8533a35a919a6a6c5fa293b5cba76000e9403c64dfd790fb9c649b7838544929b1fee8

Dash adaptations:
- src/net_processing.h: PeerManager::Options has `uint32_t max_orphan_txs_size{DEFAULT_MAX_ORPHAN_TRANSACTIONS_SIZE * 1000000}` instead of upstream's `max_orphan_txs{DEFAULT_MAX_ORPHAN_TRANSACTIONS}`, because Dash limits orphans by total size (-maxorphantxsize, MB), not by count (-maxorphantx). The DEFAULT_MAX_ORPHAN_TRANSACTIONS constant is not added (Dash doesn't have it), and DEFAULT_MAX_ORPHAN_TRANSACTIONS_SIZE is kept
- src/net_processing.h: DEFAULT_TXRECONCILIATION_ENABLE moved here from node/txreconciliation.h as upstream does, placed above Dash's DEFAULT_MAX_ORPHAN_TRANSACTIONS_SIZE
- src/net_processing.h/.cpp: PeerManager::make and the PeerManagerImpl constructor keep all of Dash's extra parameters (dstxman, mn_metaman, mn_sync, sporkman, chainlocks, clhandler, nodeman, dmnman, cj_walletman, isman, llmq_ctx); only the trailing `bool ignore_incoming_txs` becomes `Options opts`, and the m_opts{opts} initializer goes after m_clhandler
- src/net_processing.cpp: the orphan-limit line becomes `m_orphanage.LimitOrphans(m_opts.max_orphan_txs_size)` in place of Dash's inline gArgs -maxorphantxsize*1000000 computation. Dash's ForgetTx() call and comments are kept (upstream's m_txrequest.ForgetTxHash/GetWitnessHash lines are not brought in)
- src/net_processing.cpp: AddToCompactExtraTransactions keeps Dash's GetInstanceHash() (upstream uses GetWitnessHash()); only the gArgs read becomes m_opts.max_extra_txs
- src/net_processing.cpp: upstream's `-#include <common/args.h>` hunk doesn't apply because Dash's net_processing.cpp never included it. util/system.h stays because Dash still uses gArgs there for -pushversion and the devnet name
- src/node/peerman_args.cpp: includes <util/system.h> instead of <common/args.h> (Dash hasn't done the common/args split, bitcoin#27419, and ArgsManager lives in util/system.h); reads -maxorphantxsize and stores clamp(>=0)*1000000 into max_orphan_txs_size, the same value Dash computed inline before; the other three options match upstream
- src/init.cpp: peerman_opts is built and ApplyArgsManOptions is called just before Dash's PeerManager::make, whose Dash arguments are unchanged, with peerman_opts as the last argument. The node/txreconciliation.h include becomes node/peerman_args.h, and Dash's node/sync_manager.h include stays
- src/test/util/setup_common.{h,cpp}: Dash builds peers through its own MakePeerManager(connman, node, banman, ...) helper, so the helper's last parameter changes from `bool ignore_incoming_txs` to `PeerManager::Options opts`. TestingSetup builds peerman_opts with ApplyArgsManOptions(*m_node.args, ...) as upstream does. setup_common.h now includes <net_processing.h> because Options must be a complete type there (node/context.h only forward-declares PeerManager). Upstream's connman line in this hunk is not taken, because Dash creates connman earlier in ChainTestingSetup
- src/test/denialofservice_tests.cpp: the four call sites keep Dash's MakePeerManager helper and pass `{}` instead of `/*ignore_incoming_txs=*/false`, which matches upstream's use of `{}`
- src/test/net_peer_connection_tests.cpp (Dash-only caller, not touched upstream): its MakePeerManager call now passes `{}` for the new Options parameter
@DCG-Claude
DCG-Claude force-pushed the backport-0.26-b064-src-node branch from e796595 to 8b9cea6 Compare October 1, 2026 11:05
@DCG-Claude

Copy link
Copy Markdown
Collaborator Author

CI failed at e796595 on thepastaclaw/dash: linux64_asan-test / Test source

The backport's Dash adaptation in node/peerman_args.cpp multiplied -maxorphantxsize by 1000000 in uint32_t, which overflows at startup for -maxorphantxsize=100000 (mempool_package_onemore.py); Dash's old inline code had the same overflow but only ran when an orphan was handled. It now clamps the MB value to [0, UINT32_MAX/1000000] before multiplying, using the std::clamp style upstream uses for -blockreconstructionextratxn, so the value saturates at about 4.29 GB instead of wrapping. (folded into the bitcoin#27499 commit)


🤖 backportsys, on behalf of the Dash backport pipeline.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Potential PR merge conflicts

This is advisory only. It does not block CI, but it marks PRs that will likely need a rebase depending on merge order.

If these PRs merge first

This PR will likely need a rebase:

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.

1 participant