0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-09 10:43:19 -05:00
bitcoin-bitcoin-core/src
Andrew Chow df98a12fc2
Merge bitcoin/bitcoin#28350: Log explicit error message when coindb is found in inconsistent state
df60de770d log: Print error message when coindb is in inconsistent state (Fabian Jahr)

Pull request description:

  While doing manual testing on assumeutxo this week I managed to put the coindb into an inconsistent state twice. For a normal user, this can also happen if their computer crashes during a flush or if they try to stop their node during a flush and then get tired of waiting and just shut their computer down or kill the process. It's an edge case but I wouldn't be surprised if this does happen more often when assumeutxo gets used more widely because there might be multiple flushes happening during loading of the UTXO set in the beginning and users may think something is going wrong because of the unexpected wait or they forgot some configs and want to start over quickly.

  The problem is, when this happens at first the node starts up normally until it's time to flush again and then it hits an assert that the user can not understand.

  ```
  2023-08-25T16:31:09Z [httpworker.0] [snapshot] 52000000 coins loaded (43.30%, 6768 MB)
  2023-08-25T16:31:16Z [httpworker.0] Cache size (7272532192) exceeds total space (7256510300)
  2023-08-25T16:31:16Z [httpworker.0] FlushSnapshotToDisk: flushing coins cache (7272 MB) started
  Assertion failed: (old_heads[0] == hashBlock), function BatchWrite, file txdb.cpp, line 126.
  Abort trap: 6
  ```

  We should at least log an error message that gives users a hint of what the problem is and what they can do to resolve it. I am keeping this separate from the assumeutxo project since this issue can also happen during any regular flush.

ACKs for top commit:
  jonatack:
    ACK df60de770d
  achow101:
    ACK df60de770d
  ryanofsky:
    Code review ACK df60de770d
  jamesob:
    Code review ACK df60de770d

Tree-SHA512: b546aa0b0323ece2962867a29c38e014ac83ae8f1ded090da2894b4ff2450c05229629c7e8892f7b550cf7def4038a0b4119812e548e11b00c60b1dc3d4276d2
2023-09-01 13:25:01 -04:00
..
bench crypto: refactor ChaCha20 classes to use Span<std::byte> interface 2023-08-17 15:26:34 -04:00
common Rename script/standard.{cpp/h} to script/solver.{cpp/h} 2023-08-14 17:39:49 -04:00
compat Sort includes in compat.h 2023-08-08 17:50:41 +02:00
config
consensus Use int32_t type for most transaction size/weight values 2023-06-12 19:47:19 +01:00
crc32c Update crc32c subtree to latest upstream master 2022-08-13 13:55:38 +01:00
crypto crypto: make ChaCha20::SetKey wipe buffer 2023-08-17 15:37:41 -04:00
index Remove unused includes from blockfilter.h 2023-08-17 18:28:15 +02:00
init init: remove config option names from translated -loglevel strings 2023-06-15 10:27:56 -06:00
interfaces Move CTxDestination to its own file 2023-08-14 17:38:27 -04:00
ipc refactor: Move system from util to common library 2023-05-20 12:08:13 +02:00
kernel config: default acceptnonstdtxn=0 on all chains 2023-08-28 22:09:39 +10:00
leveldb Update leveldb-subtree subtree to latest upstream 2022-09-29 16:43:30 +01:00
logging Use steady clock for logging timer 2023-01-31 18:48:50 +01:00
minisketch Update minisketch subtree to latest upstream 2022-10-23 15:03:04 +01:00
node config: default acceptnonstdtxn=0 on all chains 2023-08-28 22:09:39 +10:00
policy Merge bitcoin/bitcoin#26291: Update MANDATORY_SCRIPT_VERIFY_FLAGS 2023-08-23 16:19:39 -04:00
primitives scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
qt Merge bitcoin-core/gui#749: make '-min' minimize wallet loading dialog 2023-08-31 12:29:24 +01:00
rpc Merge bitcoin/bitcoin#28287: rpc, test: add sendmsgtopeer rpc and a test for net-level deadlock situation 2023-08-24 17:34:57 -04:00
script refactor: Add missing includes 2023-08-17 15:55:01 +02:00
secp256k1 Update secp256k1 subtree to latest upstream master 2023-07-18 15:25:05 +01:00
support Don't derive secure_allocator from std::allocator 2023-07-24 22:33:40 -07:00
test refactor: Use HashWriter over legacy CHashWriter 2023-08-25 17:09:13 +02:00
univalue Remove unused raw-pointer read helper from univalue 2023-07-27 14:24:52 +02:00
util Clean up things that include script/standard.h 2023-08-14 17:38:27 -04:00
wallet Merge bitcoin/bitcoin#27585: fuzz: improve coinselection 2023-08-24 16:11:20 -04:00
zmq p2p, refactor: return std::optional<CNetAddr> in LookupHost 2023-05-26 13:41:07 -03:00
.bear-tidy-config ci: filter all subtrees from tidy output 2023-06-29 11:59:31 +01:00
.clang-format
.clang-tidy refactor: Enable all clang-tidy plugin bitcoin tests 2023-08-16 14:48:06 +02:00
addrdb.cpp script: appease spelling linter 2023-06-29 16:14:07 -06:00
addrdb.h fix includes for touched header files (iwyu) 2023-05-29 13:26:31 +02:00
addresstype.cpp Refactor: Remove confusing static_cast 2023-08-17 15:55:07 +02:00
addresstype.h Move CTxDestination to its own file 2023-08-14 17:38:27 -04:00
addrman.cpp refactor: Use HashWriter over legacy CHashWriter 2023-08-25 17:09:13 +02:00
addrman.h doc: update Select function description 2023-05-24 12:03:18 -07:00
addrman_impl.h addrman: change asserts to Assumes 2023-05-26 15:47:55 -07:00
arith_uint256.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
arith_uint256.h Fix clang-tidy readability-const-return-type violations 2023-02-01 11:33:35 +01:00
attributes.h Introduce platform-agnostic ALWAYS_INLINE macro 2023-05-04 20:57:51 +01:00
banman.cpp refactor: Move system from util to common library 2023-05-20 12:08:13 +02:00
banman.h refactor: Move fs.* to util/fs.* 2023-03-23 12:55:18 +01:00
base58.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
base58.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
bech32.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
bech32.h
bip324.cpp refactor: add missing headers for BIP324 ciphersuite 2023-08-15 07:30:48 +05:30
bip324.h refactor: add missing headers for BIP324 ciphersuite 2023-08-15 07:30:48 +05:30
bitcoin-chainstate.cpp assumeutxo cleanup: Move IsInitialBlockDownload & NotifyHeaderTip to ChainstateManager 2023-08-18 12:52:30 -04:00
bitcoin-cli-res.rc
bitcoin-cli.cpp refactor: Move system from util to common library 2023-05-20 12:08:13 +02:00
bitcoin-tx-res.rc
bitcoin-tx.cpp kernel: Remove Univalue from kernel library 2023-07-25 17:40:07 +02:00
bitcoin-util-res.rc
bitcoin-util.cpp refactor: Move system from util to common library 2023-05-20 12:08:13 +02:00
bitcoin-wallet-res.rc
bitcoin-wallet.cpp refactor: Move system from util to common library 2023-05-20 12:08:13 +02:00
bitcoind-res.rc
bitcoind.cpp Remove the syscall sandbox 2023-06-16 10:38:19 +01:00
blockencodings.cpp refactor: Fix logging.h includes 2023-08-05 10:42:56 +02:00
blockencodings.h script: remove out-of-date snprintf TODO 2023-02-15 14:42:28 -08:00
blockfilter.cpp Remove unused includes from blockfilter.h 2023-08-17 18:28:15 +02:00
blockfilter.h Remove unused includes from blockfilter.h 2023-08-17 18:28:15 +02:00
chain.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
chain.h Documentation improvements for assumeutxo 2023-07-24 16:23:38 -04:00
chainparams.cpp test: Throw error when -signetchallenge is non-hex 2023-05-25 19:24:05 +02:00
chainparams.h test: Throw error when -signetchallenge is non-hex 2023-05-25 19:24:05 +02:00
chainparamsbase.cpp refactor: Use ChainType enum exhaustively 2023-05-10 10:39:58 +02:00
chainparamsbase.h refactor: Use ChainType enum exhaustively 2023-05-10 10:39:58 +02:00
chainparamsseeds.h p2p: update hardcoded mainnet seeds for 25.x 2023-04-20 06:08:22 -07:00
checkqueue.h Remove the syscall sandbox 2023-06-16 10:38:19 +01:00
clientversion.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
clientversion.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
coins.cpp Use PoolAllocator for CCoinsMap 2023-03-23 19:38:38 +01:00
coins.h Use PoolAllocator for CCoinsMap 2023-03-23 19:38:38 +01:00
compressor.cpp Clean up things that include script/standard.h 2023-08-14 17:38:27 -04:00
compressor.h
core_io.h kernel: Remove Univalue from kernel library 2023-07-25 17:40:07 +02:00
core_memusage.h
core_read.cpp kernel: Remove Univalue from kernel library 2023-07-25 17:40:07 +02:00
core_write.cpp Rename script/standard.{cpp/h} to script/solver.{cpp/h} 2023-08-14 17:39:49 -04:00
cuckoocache.h clang-tidy: Fix modernize-use-default-member-init in headers 2023-01-31 11:50:10 +00:00
dbwrapper.cpp Merge bitcoin/bitcoin#28186: kernel: Prune leveldb headers 2023-08-07 22:31:46 +02:00
dbwrapper.h refactor: Correct dbwrapper key naming 2023-08-05 10:45:19 +02:00
deploymentinfo.cpp Decouple RegTestChainParams from ArgsManager 2023-03-15 16:42:42 +01:00
deploymentinfo.h Decouple RegTestChainParams from ArgsManager 2023-03-15 16:42:42 +01:00
deploymentstatus.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
deploymentstatus.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
dummywallet.cpp move-only: Extract common/args and common/config.cpp from util/system 2023-04-19 10:48:30 +02:00
external_signer.cpp Fix clang-tidy performance-unnecessary-copy-initialization warnings 2023-05-09 18:48:52 +02:00
external_signer.h refactor: Move system from util to common library 2023-05-20 12:08:13 +02:00
flatfile.cpp refactor: Extract util/fs_helpers from util/system 2023-03-23 12:52:00 +01:00
flatfile.h Merge bitcoin/bitcoin#27254: refactor: Extract util/fs from util/system 2023-04-03 14:41:22 +01:00
hash.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
hash.h doc: Remove comments that just repeat what the code does 2023-07-12 10:01:51 +02:00
headerssync.cpp [headerssync] Make m_commit_offset protected 2022-12-12 21:06:04 +00:00
headerssync.h [headerssync] Make m_commit_offset protected 2022-12-12 21:06:04 +00:00
httprpc.cpp scripted-diff: Use UniValue::find_value method 2023-05-09 18:47:14 +02:00
httprpc.h
httpserver.cpp Merge bitcoin/bitcoin#27949: http: update libevent workaround to correct version 2023-06-28 12:20:25 +01:00
httpserver.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
i2p.cpp refactor: Move system from util to common library 2023-05-20 12:08:13 +02:00
i2p.h refactor: Move fs.* to util/fs.* 2023-03-23 12:55:18 +01:00
indirectmap.h
init.cpp Merge bitcoin/bitcoin#28354: test: default acceptnonstdtxn=0 on all chains 2023-08-29 09:27:19 +01:00
init.h refactor: index, decouple 'Init' from 'Start' 2023-07-10 10:47:17 -03:00
key.cpp Add ElligatorSwift key creation and ECDH logic 2023-06-23 14:22:33 -04:00
key.h Add ElligatorSwift key creation and ECDH logic 2023-06-23 14:22:33 -04:00
key_io.cpp Rename script/standard.{cpp/h} to script/solver.{cpp/h} 2023-08-14 17:39:49 -04:00
key_io.h Clean up things that include script/standard.h 2023-08-14 17:38:27 -04:00
logging.cpp [log] add category TXPACKAGES for orphanage and package relay 2023-08-29 16:41:22 +01:00
logging.h [log] add category TXPACKAGES for orphanage and package relay 2023-08-29 16:41:22 +01:00
Makefile.am move-only: Create src/kernel/mempool_removal_reason.h 2023-08-17 16:26:20 +02:00
Makefile.bench.include Merge bitcoin/bitcoin#28008: BIP324 ciphersuite 2023-08-10 11:58:59 +02:00
Makefile.crc32c.include build: Create .la library for crc32c 2022-04-26 16:25:38 -04:00
Makefile.leveldb.include Use more specific path when including memenv.h header 2022-06-23 15:33:01 +02:00
Makefile.minisketch.include build: Build minisketch test in make check, not in make 2022-07-21 10:42:09 +01:00
Makefile.qt.include Build: Log when test -f fails in Makefile 2023-02-03 22:33:14 +01:00
Makefile.qt_locale.include qt: Periodic translation updates from Transifex 2023-02-27 13:53:29 +00:00
Makefile.qttest.include build: extract $(BOOST_CPPFLAGS) from $(BITCOIN_INCLUDES) 2022-09-13 17:15:17 +01:00
Makefile.test.include Merge bitcoin/bitcoin#28008: BIP324 ciphersuite 2023-08-10 11:58:59 +02:00
Makefile.test_fuzz.include [fuzz] Move ConsumeNetAddr to fuzz/util/net.h 2022-11-17 14:52:45 +00:00
Makefile.test_util.include Merge bitcoin/bitcoin#27425: test: move remaining rand code from util/setup_common to util/random 2023-07-19 10:26:11 +01:00
Makefile.univalue.include
mapport.cpp Remove the syscall sandbox 2023-06-16 10:38:19 +01:00
mapport.h Remove configure-time setting of DEFAULT_UPNP 2023-01-28 15:24:13 +00:00
memusage.h Calculate memory usage correctly for unordered_maps that use PoolAllocator 2023-03-23 19:38:38 +01:00
merkleblock.cpp
merkleblock.h
net.cpp refactor: make Transport::ReceivedBytes just return success/fail 2023-08-23 20:13:49 -04:00
net.h refactor: make Transport::ReceivedBytes just return success/fail 2023-08-23 20:13:49 -04:00
net_permissions.cpp Merge bitcoin/bitcoin#26261: p2p: cleanup LookupIntern, Lookup and LookupHost 2023-05-30 11:39:59 -04:00
net_permissions.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
net_processing.cpp [doc] move comment about AlreadyHaveTx DoS score to the right place 2023-08-29 16:41:22 +01:00
net_processing.h net processing: clamp -blockreconstructionextratxn to uint32_t bounds 2023-07-25 21:51:20 +01:00
net_types.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
net_types.h
netaddress.cpp net, refactor: pass reference for peer address in GetReachabilityFrom 2023-06-05 11:02:47 -04:00
netaddress.h refactor: use Span for SipHash::Write 2023-07-17 13:27:46 +02:00
netbase.cpp Remove now-unnecessary poll, fcntl includes from net(base).cpp 2023-06-28 16:35:45 -05:00
netbase.h p2p, refactor: return std::optional<CNetAddr> in LookupHost 2023-05-26 13:41:07 -03:00
netgroup.cpp refactor: Use HashWriter over legacy CHashWriter (via SerializeHash) 2023-08-25 17:09:32 +02:00
netgroup.h [netgroupman] Remove NetGroupManager::GetAsmap() 2022-04-20 14:35:53 +01:00
netmessagemaker.h
noui.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
noui.h
outputtype.cpp Clean up things that include script/standard.h 2023-08-14 17:38:27 -04:00
outputtype.h Move CTxDestination to its own file 2023-08-14 17:38:27 -04:00
pow.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
pow.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
prevector.h util: implement prevector's move ctor & move assignment 2023-03-26 15:49:52 +02:00
protocol.cpp refactor: Remove duplicate allNetMessageTypesVec 2023-07-11 19:26:52 +02:00
protocol.h doc: Remove unused NO_BLOOM_VERSION constant 2023-05-15 10:18:58 +02:00
psbt.cpp Move Taproot{SpendData/Builder} to signingprovider.{h/cpp} 2023-08-14 17:38:27 -04:00
psbt.h Merge bitcoin/bitcoin#25939: rpc: In utxoupdatepsbt also look for the tx in the txindex 2023-04-21 14:06:12 -04:00
pubkey.cpp Add ElligatorSwift key creation and ECDH logic 2023-06-23 14:22:33 -04:00
pubkey.h Add BIP324Cipher, encapsulating key agreement, derivation, and stream/AEAD ciphers 2023-07-26 17:09:23 -04:00
random.cpp crypto: require key on ChaCha20 initialization 2023-08-17 15:31:27 -04:00
random.h crypto: refactor ChaCha20 classes to use Span<std::byte> interface 2023-08-17 15:26:34 -04:00
randomenv.cpp refactor: don't avoid sys/types.h on when building for Windows 2023-04-03 14:44:48 +01:00
randomenv.h
rest.cpp rest: bugfix, fix crash error when calling /deploymentinfo 2023-06-12 10:24:14 -03:00
rest.h Handle query string when parsing data format 2022-03-10 12:01:53 +01:00
reverse_iterator.h doc: remove usages of C++11 2023-01-12 13:42:44 +00:00
scheduler.cpp Remove the syscall sandbox 2023-06-16 10:38:19 +01:00
scheduler.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
serialize.h refactor: use "if constexpr" in std::vector's Unserialize() 2023-08-03 10:35:22 +02:00
shutdown.cpp kernel: Add fatalError method to notifications 2023-06-28 09:52:33 +02:00
shutdown.h kernel: Add fatalError method to notifications 2023-06-28 09:52:33 +02:00
signet.cpp Clean up things that include script/standard.h 2023-08-14 17:38:27 -04:00
signet.h
span.h refactor: Use reinterpret_cast where appropriate 2023-07-24 15:32:35 +02:00
streams.cpp streams: Teach AutoFile how to XOR 2023-07-19 18:12:42 +02:00
streams.h streams: Teach AutoFile how to XOR 2023-07-19 18:12:42 +02:00
sync.cpp
sync.h doc: Export threadsafety.h from sync.h 2023-01-25 09:33:26 +01:00
threadsafety.h
timedata.cpp move-only: Extract common/args and common/config.cpp from util/system 2023-04-19 10:48:30 +02:00
timedata.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
tinyformat.h clang-tidy: Fix modernize-use-default-member-init in headers 2023-01-31 11:50:10 +00:00
torcontrol.cpp Replace LocaleIndependentAtoi with ToIntegral 2023-08-08 16:04:22 +02:00
torcontrol.h iwyu on torcontrol 2023-08-08 16:03:40 +02:00
txdb.cpp log: Print error message when coindb is in inconsistent state 2023-08-27 20:16:43 +02:00
txdb.h kernel: Pass interrupt reference to chainman 2023-06-28 09:52:27 +02:00
txmempool.cpp move-only: Create src/kernel/mempool_removal_reason.h 2023-08-17 16:26:20 +02:00
txmempool.h move-only: Create src/kernel/mempool_removal_reason.h 2023-08-17 16:26:20 +02:00
txorphanage.cpp [log] add more logs related to orphan handling 2023-08-29 16:41:22 +01:00
txorphanage.h scripted-diff: Following the C++ Standard rules for identifiers with _. 2023-06-20 10:23:08 +02:00
txrequest.cpp refactor: use Span for SipHash::Write 2023-07-17 13:27:46 +02:00
txrequest.h
uint256.cpp refactor: modernize the implementation of uint256.* 2022-12-10 14:34:44 -06:00
uint256.h Merge bitcoin/bitcoin#27927: util: Allow std::byte and char Span serialization 2023-06-28 15:12:12 -04:00
undo.h
validation.cpp [log] include wtxid in tx {relay,validation,orphanage} logging 2023-08-29 16:41:22 +01:00
validation.h assumeutxo cleanup: Move IsInitialBlockDownload & NotifyHeaderTip to ChainstateManager 2023-08-18 12:52:30 -04:00
validationinterface.cpp Fix clang-tidy readability-const-return-type violations 2023-02-01 11:33:35 +01:00
validationinterface.h refactor: add kernel/cs_main.* 2023-01-05 09:05:14 +00:00
version.h doc: Remove unused NO_BLOOM_VERSION constant 2023-05-15 10:18:58 +02:00
versionbits.cpp refactor: use braced init for integer constants instead of c style casts 2023-01-03 19:31:29 -06:00
versionbits.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
walletinitinterface.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
warnings.cpp refactor: Move system from util to common library 2023-05-20 12:08:13 +02:00
warnings.h