Repository navigation
init: fix reindex deadlock by waking cv after interrupt - #35652
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35652. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
l0rinc
left a comment
There was a problem hiding this comment.
ACK 4c728029933e0c69b813745f9fea72fdc2456aa0
Reviewed the change and reproduced the issue locally with a temporary monkey patch that requests interrupt before loading blk00000.dat during -reindex.
Local monkey-patch reproducer
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp
--- a/src/node/blockstorage.cpp (revision 1835f2fcbf482035e1c11c72ae39cee4e24e4c00)
+++ b/src/node/blockstorage.cpp (revision 5d358314134771fb2b344f966b8cab2440ede334)
@@ -43,6 +43,7 @@
#include <cerrno>
#include <compare>
+#include <cstdlib>
#include <cstddef>
#include <cstdio>
#include <exception>
@@ -1295,6 +1296,12 @@
break; // This error is logged in OpenBlockFile
}
LogInfo("Reindexing block file blk%05u.dat (%d%% complete)...", (unsigned int)nFile, nFile * 100 / total_files);
+ if (std::getenv("WAIT_FOR_INTERRUPT_BEFORE_GENESIS")) {
+ LogInfo("Monkey patch: setting interrupt before loading blk%05u.dat", (unsigned int)nFile);
+ if (!const_cast<util::SignalInterrupt&>(chainman.m_interrupt)()) LogError("Monkey patch: failed to set interrupt");
+ LogInfo("Interrupt requested. Exit reindexing.");
+ return;
+ }
chainman.LoadExternalBlockFile(file, &pos, &blocks_with_unknown_parent);
if (chainman.m_interrupt) {
LogInfo("Interrupt requested. Exit reindexing.");Exercised before/after with:
DATADIR="$(mktemp -d)"
cmake --build build -j 8 --target bitcoind
build/bin/bitcoind -datadir="$DATADIR" -stopatheight=100
WAIT_FOR_INTERRUPT_BEFORE_GENESIS=1 build/bin/bitcoind -datadir="$DATADIR" -reindexBefore the fix, bitcoind -reindex logged Interrupt requested. Exit reindexing. and initload thread exit, but stayed alive until I interrupted it manually.
With this change, the same reproducer exits on its own and reaches Shutdown done.
I left a few non-blocking test suggestions around test cost and making the restart check cover reindex recovery, but nothing blocking.
Someone else familiar with the code should also review it.
4c72802 to
85de941
Compare
|
Forced pushed from 4c728029933e0c69b813745f9fea72fdc2456aa0 to 85de9416ff2b959e34b65509a8c710849de08478 4c72802993...85de9416ff
|
If shutdown interrupts ImportBlocks() before genesis activation, no blockTip notification is sent. The wait predicate allows shutdown to occur, but the condition variable is never notified, so init can remain stuck waiting for genesis activation. Notify the tip condition variable after ImportBlocks() returns so interrupted imports wake the wait and let it observe the shutdown request. Add test coverage for interrupting startup after reindex block files import begins, which exercises the path where ImportBlocks() can return before genesis activation.
85de941 to
c1313b1
Compare
|
Forced pushed 85de9416ff...c1313b199f
|
|
Thanks for including the minimal test. For me, it fails on the first attempt without recompiling, and passes as soon as I re-compile. review ACK c1313b1 🦁 Show signatureSignature: |
| // Import blocks and ActivateBestChain() | ||
| ImportBlocks(chainman, vImportFiles); | ||
| // An interrupted import may return without activating genesis. Wake | ||
| // the init thread's genesis wait, which is otherwise only notified |
There was a problem hiding this comment.
Just noting that there is also a m_tip_block_cv notification in Interrupt(), but that would run from the same init thread that is being blocked and is thus never executed in the interrupted reindex case.
|
post-merge code review ACK c1313b1 |
…05fc7ab 81405fc7ab Merge bitcoin/bitcoin#35689: test: Inline incorrect check in `util_tests` cd2a4bc510 test: Redeclare variable as signed in `util_tests` 6f1c56f03a Merge bitcoin/bitcoin#35670: net: optimize compact block extra tx iteration e94fda8a40 Merge bitcoin/bitcoin#35685: doc: Archive 30.3 release notes 5223cf1795 Merge bitcoin/bitcoin#35616: refactor: Use u64 over size_t for all cache sizes to fix a 32-bit overflow c0e91efdb3 Merge bitcoin/bitcoin#35295: validation: fetch block input prevouts in parallel during ConnectBlock f0da26cfc8 Merge bitcoin/bitcoin#34997: p2p: Don't participate in addr relay with feelers 443179a9eb doc: Archive 30.3 release notes fabafd91f1 refactor: Use u64 over size_t for all cache sizes to fix a 32-bit overflow 32941e1314 Merge bitcoin/bitcoin#35649: depends: move FreeBSD SDK handling to CI f379d716b1 Merge bitcoin/bitcoin#35669: doc: archive release notes for v31.1 881bb7b355 Merge bitcoin/bitcoin#35673: refactor: Move LoadGenesisBlock to ChainstateManager 3f3e644beb Merge bitcoin/bitcoin#35678: private broadcast: define and use new RPC_LIMIT_EXCEEDED error code ( + other follow-ups) e3b026bf56 Merge bitcoin/bitcoin#34020: mining: add getTransactions(ByWitnessID) IPC methods 62f9089343 Merge bitcoin/bitcoin#35386: doc: add an AI contribution policy fa615bd163 refactor: Move LoadGenesisBlock to ChainstateManager 8ac222484c private broadcast: remove no-op [[nodiscard]] 191bdcba26 test: align test better with described scenario 7ad311be18 test: use BOOST_CHECK_EQUAL for PrivateBroadcast::AddResult 82a02a2a22 rpc: define and use new RPC_LIMIT_EXCEEDED error code a64df338e6 Merge bitcoin/bitcoin#35651: doc: Improve offline-signing-tutorial after 32489 4498fa5d5b Merge bitcoin/bitcoin#35406: private broadcast: limit outstanding txs to count of 10,000 ec5edcd72b Merge bitcoin/bitcoin#35661: Update libmultiprocess subtree to add `ThreadMap.makePool` method ea67fea062 Merge bitcoin/bitcoin#35464: kernel: Add function for creating chainparams with a signet challenge a7b5f23bb8 Merge bitcoin/bitcoin#35667: refactor: Use `NetworkErrorString` for macOS code in `netif.cpp` 69fc991791 Merge bitcoin/bitcoin#32606: p2p: Drop unsolicited CMPCTBLOCK from non-HB peer and when blocksonly 1a3cbf1bd2 net: optimize compact block extra tx iteration bc33509ae2 Merge bitcoin/bitcoin#35650: doc: Add release notes for 32489 (exportwatchonlywallet RPC) 2b6e767d96 doc: archive release notes for v31.1 b0735336ee p2p: Don't participate in addr relay with feeler connections 302733fd96 Merge bitcoin/bitcoin#35652: init: fix reindex deadlock by waking cv after interrupt c1313b199f init: wake genesis wait after ImportBlocks() returns eccb04a321 refactor: Use `NetworkErrorString` for macOS code in `netif.cpp` f79ecfd9c7 Merge bitcoin/bitcoin#35658: refactor: Drop unneeded `<sys/types.h>` include before `<ifaddrs.h>` 22ac4ad949 ci: ensure we use correct lld version in OpenBSD job 495f43f7b3 ci: FreeBSD 15.1 244739db9d depends: move FreeBSD SDK handling to CI bab0120053 Merge bitcoin/bitcoin#35621: validation: Ignore eventual error message from flushing in AcceptBlock 02afa66169 Merge commit '6b0a907302364649dcaffeb0340b985f14141b4e' into pr/subtree-11 6b0a907302 Squashed 'src/ipc/libmultiprocess/' changes from 3edbe8f67c1..16bf05dea02 22c328d388 refactor: Drop unneeded `<sys/types.h>` include before `<ifaddrs.h>` 2063f02bd5 Merge bitcoin/bitcoin#35510: test: SOCKS5 proxy: expect that connection may be reset during SOCKS5 handshake or data forwarding 1360001f43 Merge bitcoin/bitcoin#34959: wallet: Enforce BDB btree levels and overflow item sizes 10ffef4b3b Merge bitcoin/bitcoin#35604: log: expose `-logratelimit` in normal help b393985aa0 Merge bitcoin/bitcoin#35634: txospenderindex: use zero-byte entry values 1835f2fcbf Merge bitcoin/bitcoin#35653: fuzz: Remove `ConsumeUniValue` 9f3e427228 fuzz: Remove ConsumeUniValue 68cb7840d2 doc: improve offline-signing-tutorial after 32489 32ddfc92d9 Merge bitcoin/bitcoin#35599: doc: Add release notes for #33671 (getbalances nonmempool field) f56804bcf5 Merge bitcoin/bitcoin#35640: ci: use a 8x instance over 16x for riscv job 239d6c5260 Merge bitcoin/bitcoin#35614: HTTPServer: Prevent race condition between worker thread and I/O thread cddbad325d doc: Add release notes for 32489 (exportwatchonlywallet RPC) 0a1bbec688 Merge bitcoin/bitcoin#32489: wallet: Add `exportwatchonlywallet` RPC to export a watchonly version of a wallet 4a007126fb Merge bitcoin/bitcoin#35147: depends: Boost 1.91.0-1 31abaa264c doc: add an AI contribution policy a15bdc0598 doc: update offline-signing-tutorial to use exportwatchonlywallet rpc a388076401 test: Test for exportwatchonlywallet d053e3e5c8 wallet, rpc: Add exportwatchonlywallet RPC 444878efef wallet: Add CWallet::ExportWatchOnly f9273f01db wallet: Move listdescriptors retrieving from RPC to CWallet a1c83789a7 wallet: Write new descriptor's cache in AddWalletDescriptor 1e996640e6 wallet: Use Descriptor::CanSelfExpand() in CanGetAddresses() d2ee9227da descriptor: Add CanSelfExpand() 2990bd7735 Merge bitcoin/bitcoin#35118: fuzz: add ipc round-trip fuzz target fb1d152c24 depends: Boost 1.91.0-1 ba48852f9e Merge bitcoin/bitcoin#35438: test: introduce NodeSigner, run feature_taproot.py without wallet compiled 47bbed052e ci: use true|false over "true|false" 9a25bc3989 ci: use a 8x instance over 16x 9871dc7ab4 Merge bitcoin/bitcoin#31425: CI: Add Riscv bare metal job 113402286e doc: add txospenderindex release note ce06878288 index: shrink txospenderindex value markers a99148d576 test kernel: Don't log on warnings change 5b4fd284f4 kernel: Generate a signet with a challenge 037ad77071 fuzz: add IPC round-trip target a8823c0996 Merge bitcoin/bitcoin#35607: nanobench: fix performance counter buffer initialization f26c15bdd2 Merge bitcoin/bitcoin#35397: ci: add OpenBSD Clang cross job 91586f701e test: introduce NodeSigner, run feature_taproot.py without wallet compiled 771200ca43 test: return full keypair from `getnewdestination` helper 4e29de719e private broadcast: add release note for limited cap cbf8c107c1 Release cs_main between individual private tx re-attempts 5aea3d0373 private broadcast: limit outstanding txs to count of 10,000 dc282ff31d Merge bitcoin/bitcoin#35597: logging: More fully remove libevent log category ec98037f7a Merge bitcoin/bitcoin#35615: fuzz: restore CreateSock in PCP targets 43d89bb6e1 Merge bitcoin/bitcoin#35610: bitcoin-util: Add netmagic command e35c805489 Merge bitcoin/bitcoin#35129: test: add fuzz test for private broadcast dc1c17c085 doc: add release notes 0e10937184 fuzz: add coins_view_stacked fuzz harness to test concurrent leveldb reads ce610a6ff4 fuzz: update harnesses to cover CoinsViewOverlay::StartFetching 760fb22dc3 test: add unit tests for CoinsViewOverlay::StartFetching d69a3b20de doc: update CoinsViewOverlay docstring to describe parallel fetching ab2a379237 coins: fetch inputs in parallel fdf283036a coins: add ready flag to InputToFetch ede11b8314 validation: collect block inputs in CoinsViewOverlay before ConnectBlock f82043af50 coins: introduce thread pool in CoinsViewOverlay 5bf1c32008 validation: add -prevoutfetchthreads configuration option a318f43254 bitcoin-util: Add netmagic command 256482ab56 validation: In AcceptBlock, ignore flush result 3c76bd4356 Merge bitcoin/bitcoin#35603: build: QRencode cleanups f595daf1dd test: ensure HTTPServer race condition is fixed b98b10c072 test: introduce a worker thread in http socket error test 922b08d375 test: socket error handling in HTTPServer using ErrorSock mock socket 73da2a8a52 http: prevent race condition between worker thread and I/O thread 57b3bf8496 Merge bitcoin/bitcoin#35609: ci: Bump tsan config to ubuntu:26.04 with -U_FORTIFY_SOURCE d64ea15824 ci: add openBSD cross CI job 5404b62074 depends: add openbsd_LDFLAGS 2a9e35d293 Merge bitcoin/bitcoin#35588: scripted-diff: Rename `Sock::{RECV,SEND,ERR}` a0e5e30010 fuzz: restore CreateSock in PCP targets 41ceea400e scripted-diff: Rename `StatusLevel::{INFO,WARN,ERR}` f395acdeee scripted-diff: Rename `Sock::{RECV,SEND,ERR}` 7a74f65293 Merge bitcoin/bitcoin#35536: fuzz: share a single mocked steady clock across FuzzedSock instances e1290ce7f7 Merge bitcoin/bitcoin#35543: test: introduce ExtendedPrivateKey and ExtendedPublicKey classes 7ac25c9177 util, refactor: Rename local `ERR` in `Sock::Accept` bbbbab86a8 ci: Bump tsan config to ubuntu:26.04 with -U_FORTIFY_SOURCE 095596ddf7 log: expose -logratelimit option ea9afb61a1 Merge bitcoin/bitcoin#35602: doc: Clarify build docs about `pkgconf` / `pkg-config` requirements 672eedc46b Merge bitcoin/bitcoin#35220: fuzz: connman: strengthen assertions and extend coverage 0e5c718d8a Merge bitcoin/bitcoin#35506: test: ensure group data cluster pointers are live b6b1d0653a nanobench: fix perf counter buffer init 93012d7ff9 Merge bitcoin/bitcoin#35601: wallet: remove experimental warning from send and sendall 829255c8be cmake: Remove `SelectLibraryConfigurations` from `FindQRencode` module 5c55606da9 depends: Remove unused `lib/pkgconfig` in `qrencode` package 402ba10b20 cmake: Drop optional `PkgConfig` use in `FindQRencode` module 8ebfff0f88 doc: add send RPC release note fb8a103886 doc: Clarify build docs about `pkgconf` / `pkg-config` requirements 5884f5a4fa wallet: remove experimental warning from send RPCs 7b84e5106c Merge bitcoin/bitcoin#35595: ci: remove some packages from Chimera job 58560c281d ci: remove some packages from Chimera job 295ce6f45c Merge bitcoin/bitcoin#35576: test: raise `feature_reindex` RPC timeout b36730a3ef Add CI job for riscv bare metal bfdbf513f6 Add CI job for producing a static bare metal binary a9a1d92a1d build: Add option for building for bare metal envs 9b2ef81757 doc: add release notes for #33671 (getbalances nonmempool field) 633044f143 Merge bitcoin/bitcoin#35266: rpc, wallet: add an option to not load the wallet after migrating d6269e2a90 Merge bitcoin/bitcoin#35594: fuzz: cover async chainstate compaction 3765b428d1 logging: More fully remove libevent log category 703a671fbc fuzz: compact coins view db during fuzzing 0868c85fd5 refactor: rename async coin compaction 6fa4132298 fuzz: share a single mocked steady clock across FuzzedSock instances 8791c4764c test: use ExtendedPrivateKey in wallet_taproot.py 89ceafafb9 test: use ExtendedPrivateKey in wallet_listdescriptors.py bbfffcab58 test: use ExtendedPrivateKey in wallet_send.py 2ab6e590f7 test: use ExtendedPrivateKey in wallet_keypool.py 9e20118720 test: use ExtendedPrivateKey in wallet_fundrawtransaction.py 06af0cddbb test: use ExtendedPrivateKey in wallet_descriptor.py 4100fac20e test: use ExtendedPrivateKey in wallet_createwallet.py ff3f6def9a test: use ExtendedPrivateKey in wallet_bumpfee.py 003f2a01f6 test: use ExtendedPrivateKey in feature_notifications.py f988e6d6e6 test: use ExtendedPrivateKey in wallet_importdescriptors.py 0cdd817a82 add release note 517d37ce3e test: tests wallet migration with load_wallet disabled b98dd63da7 rpc: Add load_wallet argument to migratewallet RPC 4acd063ba6 wallet: make loading the wallet after migrating optional 1a3cfdf1b7 fuzz: connman: cover AddLocalServices/RemoveLocalServices c507fb3063 fuzz: connman: add outbound-bytes invariants 4a6fce43ea fuzz: connman: add AddNode/RemoveAddedNode invariants 9e6546c517 test: raise reindex mining RPC timeout d2a03d50ac test: add extendedkey.py unit tests by using BIP32 test vectors afdb378082 test: introduce ExtendedPrivateKey and ExtendedPublicKey classes 55e3a57f22 qa: Avoid UTXO reuse between test functions 9c5dd2926a p2p: Ignore CMPCTBLOCK from peer that hasn't sent SENDCMPCT bf9884f4e5 p2p: make blocksonly nodes ignore CMPCTBLOCK messages 92cea63c71 test: (Un)solicited invalid cb -> get disconnected. e845e26344 test: p2p: Nodes ignore unsolicited CMPCTBLOCK's 8313591715 p2p: Drop unsolicited CMPCTBLOCK from non-HB peer 44f377a71f refactor: test: Static assert_highbandwidth_states 25457a3272 test: Tighten getblocktxn checks in parallel cb reconstruction test. 2ee4fafa3f test: add fuzz test for private broadcast 08b7c61fc7 private broadcast: enforce sending to unique node ids 9a8ef9b0a3 test: SOCKS5 proxy: expect that connection may be reset during handshake eb3208364a test: SOCKS5 proxy: expect that connection may be reset when forwarding 4dbaa7cc65 test: generalise byte_to_base58 utility function to allow more version types df9eb72b12 test: ensure group data cluster pointers are live a5859edef4 fuzz: connman: set m_local_services/m_use_addrman_outgoing/m_max_automatic_connections 4b84c9125a fuzz: connman: add network activity invariants 9784818442 mining: add getTransactionsByWitnessID() IPC method d282ae6883 mining: add getTransactionsByTxID() IPC method 0d5e4d4712 test: restart node after IPC option override test f16b3613cd ipc: Serialize null CTransactionRef as empty Data 0f466e1094 mempool: add lookup by witness hash 51dd90fb50 refactor: Merge announce_cmpct_block() defs into one 97d08d62ba refactor: store wallet names to MigrationResult 8a739a5510 build: allow ipc fuzz builds b2de59d486 wallet, bdbro: Validate btree page levels dc3a2b9c3b wallet, bdbro: Enforce overflow data lengths git-subtree-dir: libbitcoinkernel-sys/bitcoin git-subtree-split: 81405fc7abbd1889f3978b8924e7acbe12b3403b
…after interrupt 953d012 init: wake genesis wait after ImportBlocks() returns (ismaelsadeeq) Pull request description: During startup with `-reindex`, the block index and chainstate are wiped, and the normal `LoadGenesisBlock()` startup path is skipped while block files are being indexed. The init thread can then wait for genesis to be processed via the tip-block condition variable. If shutdown is requested after the init thread enters that wait but before the import thread activates genesis, the reindex scan can return early without calling the later `LoadGenesisBlock()` fallback or `ActivateBestChains()`. Because no block tip is connected, the block-tip notification never fires. The wait predicate would accept `ShutdownRequested(node)`, but it is not evaluated again unless the condition variable is notified. Notify the tip-block condition variable after `ImportBlocks()` returns so the genesis wait can observe shutdown and exit cleanly. Described in detail bitcoin/bitcoin#35621 (comment) The current test covers the path, but won't fail deterministically. You can use L0rinc suggested patch for a deterministic patch that demonstrate the deadlock on master bitcoin/bitcoin#35652 (review) ACKs for top commit: maflcko: review ACK 953d012 🦁 mzumsande: Code Review ACK [953d012](bitcoin/bitcoin@953d012) sedited: tACK 953d012 Tree-SHA512: b17faaa2042882f2acebf688f4a28fd6bb11cc5d7f978991fe2bcba7a9df6ed82a0a2811f2e71a929189570a7926f148afdbeef5c1ca57a081e3bb914c2f6fe2
…after interrupt c1313b199fe320c8d3e7ba01577378dfb85009cf init: wake genesis wait after ImportBlocks() returns (ismaelsadeeq) Pull request description: During startup with `-reindex`, the block index and chainstate are wiped, and the normal `LoadGenesisBlock()` startup path is skipped while block files are being indexed. The init thread can then wait for genesis to be processed via the tip-block condition variable. If shutdown is requested after the init thread enters that wait but before the import thread activates genesis, the reindex scan can return early without calling the later `LoadGenesisBlock()` fallback or `ActivateBestChains()`. Because no block tip is connected, the block-tip notification never fires. The wait predicate would accept `ShutdownRequested(node)`, but it is not evaluated again unless the condition variable is notified. Notify the tip-block condition variable after `ImportBlocks()` returns so the genesis wait can observe shutdown and exit cleanly. Described in detail bitcoin/bitcoin#35621 (comment) The current test covers the path, but won't fail deterministically. You can use L0rinc suggested patch for a deterministic patch that demonstrate the deadlock on master bitcoin/bitcoin#35652 (review) ACKs for top commit: maflcko: review ACK c1313b199fe320c8d3e7ba01577378dfb85009cf 🦁 mzumsande: Code Review ACK [c1313b1](bitcoin/bitcoin@c1313b1) sedited: tACK c1313b199fe320c8d3e7ba01577378dfb85009cf Tree-SHA512: b17faaa2042882f2acebf688f4a28fd6bb11cc5d7f978991fe2bcba7a9df6ed82a0a2811f2e71a929189570a7926f148afdbeef5c1ca57a081e3bb914c2f6fe2
An interrupted import may return from ImportBlocks without activating genesis. The init thread's wait for genesis is only woken by blockTip, which never fires in that case, so a shutdown request arriving during -reindex can leave startup blocked forever. Notify m_tip_block_cv after the import so the wait can observe the shutdown request. Adapted from bitcoin#35652.
An interrupted import may return from ImportBlocks without activating genesis. The init thread's wait for genesis is only woken by blockTip, which never fires in that case, so a shutdown request arriving during -reindex can leave startup blocked forever. Notify m_tip_block_cv after the import so the wait can observe the shutdown request. Adapted: the assert_equal(0, node.process.wait()) test change from bitcoin#34241 is left out. Github-Pull: bitcoin#35652 Rebased-From: c1313b1 (partial)
…oin Core fixes (#299) * qt: the details of a transaction list its asset outputs The details dialog showed coins only: an asset transfer read as a debit and a credit of 0.00 AVN and a fee, with nothing about the asset. It now has a line for every asset output, saying what the output does and whether it is change or goes to an address of the wallet. The text is the one the PSBT dialog already gives for an output (issue, reissue, owner token, transfer, verifier string, tag, freeze). It moves to TransactionDesc::describeAssetOutput() and both dialogs use it; what the PSBT dialog shows is unchanged. * qt: transaction list: asset sent to oneself, row colours, type column An asset sent to an address of the wallet had no row of its own; the transaction showed as "Transaction fee, (n/a)". It now has a row "Asset sent to yourself" with the address, the amount and the name, and the fee row beside it. Asset change stays without a row: the wallet flags it. Such an output is also left out beside an issue, a reissue, a tag, a freeze or a transfer to somebody else, where it is a token handed back or change that releases before 5.0.7 sent to a receiving address. The balloon calls the transaction sent. Row colours. Both themes set a text colour on every table cell (QTableView::item), which overrides the colour a model gives: no amount was ever red, no unconfirmed row grey, no abandoned one marked. The colour moves to the table. The model's colours are chosen per theme, since the ones inherited from Bitcoin Core are meant for a white background. Addresses without a label keep the normal colour in the list; the Overview page, which paints its own rows, asks for theirs through a role of its own. The text colour of QTableWidget, until now hidden by the cell rule, would have made the Consolidate UTXOs list unreadable and is removed. Type column. Its width, 113 pixels, was that of Bitcoin Core's labels and cut "Asset sent to" and "Transaction fee" short. It is taken from the longest type text. A width still at the old default, or never set, is widened once the list has its model; one chosen by hand is kept. * doc: release notes for the transaction list and details changes * validation: correct lifetime of precomputed tx data In ConnectBlock the per-transaction precomputed data was declared after the script check queue control, so it was destroyed first. The control's destructor waits for the queued checks, which hold pointers into that data. On the paths that leave the loop with a break the checks are completed before either goes out of scope, but an exception thrown while checks are queued would have the worker threads read freed memory. Declared before the control, the data always outlives the queue. Upstream names this as the root cause of CVE-2024-52911. Backport of Bitcoin Core 30.3 commit 17de6d2680db, by Antoine Poinsot. Github-Pull: bitcoin/bitcoin#35209 Rebased-From: 1ed799fb21db51a12cbd5579420a61b9b5b3ee7d * wallet: feebumper, fix crash when combined bump fee is unavailable When the unconfirmed inputs of a transaction depend on a very large cluster of unconfirmed transactions, calculateCombinedBumpFee() returns nothing. The error was recorded and the empty value read all the same: an uncaught std::bad_optional_access in bumpfee and psbtbumpfee, and a crash in the GUI. It now returns the error. Backport of Bitcoin Core 30.3 commit 84c2f003b316, by furszy. Github-Pull: bitcoin/bitcoin#34870 Rebased-From: 6072a2a6a1fdde8444e3515f0d201de3fb3923a1 * wallet: fix removeprunedfunds bug with conflicting transactions removeprunedfunds erased every entry of mapTxSpends for the inputs of the removed transaction, those of conflicting transactions among them. The wallet then took the coins a conflicting transaction spends for unspent and could build a double spend of them, also after that transaction was mined. Only the entries of the removed transaction are erased. The upstream functional test is not taken: the functional suite is not adapted to Avian. Backport of Bitcoin Core 30.3 commit 290526bc6dec, by Martin Zumsande. Github-Pull: bitcoin/bitcoin#34358 Rebased-From: 1f60ca360eb83fa7982b1aac402eaaf477294197 * psbt: Fix `PSBTInputSignedAndVerified` bounds `assert` The assert used `>=`, which let input_index == psbt.inputs.size() through to an out-of-bounds read of psbt.inputs. Backport of Bitcoin Core 30.3 commit 7e1090f5e805, by Lőrinc. Github-Pull: bitcoin/bitcoin#34272 Rebased-From: 2f5b1c5f80590ffa6b5a5bcfb21fddb1dc22e852 * wallet: fix amount computed as boolean in coin selection The comparison was evaluated before the assignment, so total_amount held the result of `a - b < c` and not the amount. It decides between the message about a chain of unconfirmed transactions and plain "Insufficient funds", and worked by accident. Backport of Bitcoin Core 30.3 commit f05988aa0534, by furszy. Github-Pull: bitcoin/bitcoin#34888 Rebased-From: 0026b330c4abbbbdb96e4f0c4d380d70d8e592ab * wallet: use outpoint when estimating input size CalculateMaximumSignedInputSize() is given the outpoint being sized and did not use it, so what coin control holds for that outpoint was not found: an input selected from outside the wallet was sized as one of the wallet's own, with a low-R signature, one byte too small. Backport of Bitcoin Core 30.3 commit 1dba05e7f6b1, by Lőrinc and Antoine Poinsot, with its unit test. Github-Pull: bitcoin/bitcoin#35228 Rebased-From: cd8d3bd937b5515ea000408eb07d2ae3cd1aa417 * mining: ensure witness commitment check in submitSolution A block template keeps its CBlock, and submitSolution() changes it in place: the client brings a new coinbase. The checks cached on the block were left as they were for the template's own coinbase, so the witness commitment of the submitted coinbase was not checked, and this node could take a block for its tip that every other node refuses. The cached checks are reset with the coinbase. The Stratum v2 provider checks the commitment itself before it submits; this closes it for every user of the interface, IPC clients among them. miner_tests: a solution whose coinbase commits to other witness data is refused; the case fails without the change. The existing loop dropped the commitment from the coinbase and kept the witness nonce, which is an invalid block here, where segwit is active from the first block, and passed only through the cache. It drops the nonce too. Backport of Bitcoin Core 31.0 commit 862bd432837e, by Sjors Provoost. The upstream functional test uses the IPC interface and is not taken. Github-Pull: bitcoin/bitcoin#33745 Rebased-From: 862bd432837efeb6ab1435f75493501618ab3190 * init: wake genesis wait after ImportBlocks() returns When a shutdown interrupts ImportBlocks() before the genesis block is activated, no blockTip notification is sent. The wait for the genesis block lets a shutdown through, but nothing notified its condition variable, so start-up stayed in the wait: Ctrl-C at the start of a -reindex left a process that did not exit. The initload thread notifies the condition variable when ImportBlocks() returns, and when it gives up after a failed rebuild of the asset database, which upstream does not have. On regtest, SIGTERM as soon as the reindex of the first block file is logged: 5 of 40 runs did not exit within 20 seconds before, none of 40 with the change. Backport of Bitcoin Core 32.0 commit c1313b199fe3, by ismaelsadeeq. The upstream functional test is not taken. Github-Pull: bitcoin/bitcoin#35652 Rebased-From: c1313b199fe320c8d3e7ba01577378dfb85009cf * qt: a splash screen of Avian's own The splash screen was Bitcoin Core's with the application icon in place of the Bitcoin logo: the eagle turned and skewed in a circle with a shadow, running off the corner. The brand guidelines (brand.avn.network) allow none of that: the logomark is not to be rotated, stretched, recoloured or given effects. The new one draws the logomark as supplied, upright, with the clear space the guidelines ask for, on a field of teal to slate, with the name, the version and the copyright lines centred below it. Start-up progress is a bar, turquoise to mint, with the message under it; a message that ends in a percentage sets the bar too. Colours and gradient pairings are those of the brand palette, and the text is set in Inter, the brand typeface. On a test network the splash screen is white with the blue testnet eagle and the name of the network in a badge, as the guidelines keep the teal and the blue identity apart. Added, unmodified: the white and the testnet logomark from the brand asset bundle, and Inter Regular and Bold 4.1 with their licence (SIL OFL 1.1). * doc: release notes for the backports and the splash screen * qt: a new application icon, and one for the test networks The application icon was the eagle turned and skewed in a circle with a shadow, which the brand guidelines (brand.avn.network) do not allow. The new one is the white logomark, upright, on a rounded square in the teal of the brand. The test networks have the same in the blue of the testnet identity. - avian.png and the new avian_testnet.png are the two square pictures cut to a rounded square of 940 pixels in 1024, with a transparent margin and a smooth edge. - avian.ico and avian_testnet.ico are made from them: 16, 20, 24, 32, 40, 48, 64 and 128 pixels as bitmaps and 256 as PNG. - avian.icns is made from avian.png: 128, 256, 512 and 1024 pixels and the @2x sizes 32 and 64, all PNG. - share/pixmaps/avian.ico, the icon of the Windows installer, is the new avian.ico. - On a test network the program loads the testnet icon. It took the mainnet icon and rotated its hue, which recolours the logo. - avian_signet.ico was a copy of Bitcoin Core's signet icon. It is removed and the resource file names the testnet icon for signet. * doc: release notes for the application icon
During startup with
-reindex, the block index and chainstate are wiped, andthe normal
LoadGenesisBlock()startup path is skipped while block files arebeing indexed. The init thread can then wait for genesis to be processed via the
tip-block condition variable.
If shutdown is requested after the init thread enters that wait but before the
import thread activates genesis, the reindex scan can return early without
calling the later
LoadGenesisBlock()fallback orActivateBestChains().Because no block tip is connected, the block-tip notification never fires. The
wait predicate would accept
ShutdownRequested(node), but it is not evaluatedagain unless the condition variable is notified.
Notify the tip-block condition variable after
ImportBlocks()returns so thegenesis wait can observe shutdown and exit cleanly.
Described in detail #35621 (comment)
The current test covers the path, but won't fail deterministically. You can use L0rinc suggested patch for a deterministic patch that demonstrate the deadlock on master #35652 (review)