This is a partial backport of core#28960
https://github.com/bitcoin/bitcoin/pull/28960/commits/84f5c135b8118cbe15b8bfb4db80d61237987f64
Depends on D20502
Differential D20503
refactor: De-globalize g_signals Authored by PiRK on Aug 25 2026, 13:24.
Details
This is a partial backport of core#28960 Depends on D20502 With -DBUILD_CHRONIK=1 -DBUILD_CHAINSTATE=1
Diff Detail
Event TimelineComment Actions Build Bitcoin ABC Diffs / Diff Testing (ai-review) passed. Diff : committed changes only (\(\ ──────────────────────────────────────── 27 files reviewed:
... and 17 more files Comment Actions Build Bitcoin ABC Diffs / Diff Testing (build-clang-tidy) failed.
Tail of the build log: [416/604] Linking C executable src/secp256k1/examples/ecdsa_example [417/604] Linking C executable src/secp256k1/examples/ecdh_example [418/604] Linking C executable src/secp256k1/examples/schnorr_example [419/604] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockindex.cpp.o [420/604] Building CXX object src/test/CMakeFiles/testutil.dir/util/coins.cpp.o [421/604] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o [422/604] Building CXX object src/CMakeFiles/bitcoin-wallet.dir/bitcoin-wallet.cpp.o [423/604] Linking CXX executable src/bitcoin-tx [424/604] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o [425/604] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o [426/604] Building C object src/secp256k1/CMakeFiles/internal-bench.dir/src/bench_internal.c.o [427/604] Linking C executable src/secp256k1/internal-bench [428/604] Building CXX object src/CMakeFiles/server.dir/wallet/init.cpp.o [429/604] Building C object src/secp256k1/CMakeFiles/ecmult-bench.dir/src/bench_ecmult.c.o [430/604] Linking C executable src/secp256k1/ecmult-bench [431/604] Building CXX object src/test/CMakeFiles/testutil.dir/util/random.cpp.o [432/604] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o [433/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o [434/604] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o [435/604] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o [436/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o [437/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o [438/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o [439/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o [440/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o [441/604] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o [442/604] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o [443/604] Building CXX object src/test/CMakeFiles/testutil.dir/util/txmempool.cpp.o [444/604] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o [445/604] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o [446/604] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o [447/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o [448/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o [449/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o [450/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o [451/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o [452/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o [453/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o [454/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o [455/604] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o [456/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o [457/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o [458/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o [459/604] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o [460/604] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o [461/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o [462/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o [463/604] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_interpreter.cpp.o [464/604] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_formatter.cpp.o [465/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o [466/604] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana.cpp.o [467/604] Linking CXX executable src/iguana/iguana [468/604] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o [469/604] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o [470/604] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o [471/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o [472/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o [473/604] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o ninja: build stopped: cannot make progress due to previous errors. Build build-clang-tidy failed with exit code 1 Comment Actions Build Bitcoin ABC Diffs / Diff Testing (ai-review) passed. Diff : committed changes only (\(\ ──────────────────────────────────────────────────────────────────────── major [Functional Correctness]
→ ]8;;vscode://file//work/src/rpc/mining.cpp:491src/rpc/mining.cpp:491-492]8;;
Synchronize the chainstate signal dispatcher.
GenerateBlock() calls chainman.ProcessNewBlock(). Block callbacks use
chainman.m_options.signals. mempool.m_signals comes from a separate
options path. If these pointers differ, this RPC drains the wrong queue
and returns before block observers finish.
Use chainman.m_options.signals, as generateBlocks() already does at
Lines 205-206.
Proposed fix
- CHECK_NONFATAL(mempool.m_signals)
+ CHECK_NONFATAL(chainman.m_options.signals)
->SyncWithValidationInterfaceQueue();──────────────────────────────────────── Major 1 32 files reviewed:
... and 22 more files Print all AI prompts: coderabbit review --show-prompts Comment Actions consistently use chainman.m_options.signals throughout rpc/mining.cpp It's technically always the same thing as mempool.m_signals, and I don't expect this will ever change. But I guess using the same code path throughout the source file has some value. Comment Actions Build Bitcoin ABC Diffs / Diff Testing (ai-review) passed. Diff : committed changes only (\(\ ──────────────────────────────────────────────────────────────────────── major [Functional Correctness]
→ ]8;;vscode://file//work/src/test/validationinterface_tests.cpp:93src/test/validationinterface_tests.cpp:93-96]8;;
Synchronize before CallBlockChecked returns.
BlockChecked queues the callback. The caller at Line 197 checks
shared.use_count() immediately after this method returns. The callback
can still be pending, so UnregisterAllValidationInterfaces() has not
released the signal-held reference. This makes the test race.
Proposed fix
void CallBlockChecked() {
CBlock block;
BlockValidationState state;
m_signals.BlockChecked(block, state);
+ m_signals.SyncWithValidationInterfaceQueue();
}──────────────────────────────────────── Major 1 32 files reviewed:
... and 22 more files Print all AI prompts: coderabbit review --show-prompts
Comment Actions Build Bitcoin ABC Diffs / Diff Testing (ai-review) failed.
Tail of the build log: /work /work/abc-ci-builds/ai-review Connecting to CodeRabbit... 0s elapsed ✗ Review error Review failed: Failed to start review. Please try again. Build ai-review failed with exit code 1 | ||||||||||||||||||||||||||||||||||||||