As described in #33231 (review), when InitError()
is triggered during initialization, the node prints the error but sometimes continues running, if blockchain data already exists in the datadir.
0rm -rfd demo build && mkdir -p demo && cmake -B build && cmake --build build -j$(nproc)
1# empty state fails with error
2build/bin/bitcoind -datadir=demo -stopatheight=100 -i2psam=invalid_addr
3# init state with 10 blocks
4build/bin/bitcoind -datadir=demo -stopatheight=1000
5# error is shown but doesn't stop execution
6build/bin/bitcoind -datadir=demo -i2psam=invalid_addr
the last command does usually stop, but it seems that if the validation is happening too late, it doesn’t prevent startup:
02025-09-01T21:46:54Z Bitcoin Core version v29.99.0-7cc9a087069b (release build)
12025-09-01T21:46:54Z Using the 'arm_shani(1way,2way)' SHA256 implementation
22025-09-01T21:46:54Z Default data directory /Users/lorinc/Library/Application Support/Bitcoin
32025-09-01T21:46:54Z Using data directory /Users/lorinc/IdeaProjects/bitcoin/demo
42025-09-01T21:46:54Z Config file: /Users/lorinc/IdeaProjects/bitcoin/demo/bitcoin.conf (not found, skipping)
52025-09-01T21:46:54Z Command-line arg: datadir="demo"
62025-09-01T21:46:54Z Command-line arg: i2psam="invalid_addr"
72025-09-01T21:46:54Z Using at most 125 automatic connections (1024 file descriptors available)
82025-09-01T21:46:54Z Warning: relative datadir option 'demo' specified, which will be interpreted relative to the current working directory '/Users/lorinc/IdeaProjects/bitcoin'. This is fragile, because if bitcoin is started in the future from a different location, it will be unable to locate the current data files. There could also be data loss if bitcoin is started while in a temporary directory.
92025-09-01T21:46:54Z scheduler thread start
102025-09-01T21:46:54Z Binding RPC on address ::1 port 8332
112025-09-01T21:46:54Z Binding RPC on address 127.0.0.1 port 8332
122025-09-01T21:46:54Z Generated RPC authentication cookie /Users/lorinc/IdeaProjects/bitcoin/demo/.cookie
132025-09-01T21:46:54Z Permissions used for cookie: rw-------
142025-09-01T21:46:54Z Using random cookie authentication.
152025-09-01T21:46:54Z Starting HTTP server with 16 worker threads
162025-09-01T21:46:54Z Using wallet directory /Users/lorinc/IdeaProjects/bitcoin/demo
172025-09-01T21:46:54Z init message: Verifying wallet(s)…
182025-09-01T21:46:54Z Using /16 prefix for IP bucketing
192025-09-01T21:46:54Z init message: Loading P2P addresses…
202025-09-01T21:46:54Z Loaded 7172 addresses from peers.dat 9ms
212025-09-01T21:46:54Z init message: Loading banlist…
222025-09-01T21:46:54Z SetNetworkActive: true
232025-09-01T21:46:54Z Cache configuration:
242025-09-01T21:46:54Z * Using 2.0 MiB for block index database
252025-09-01T21:46:54Z * Using 8.0 MiB for chain state database
262025-09-01T21:46:54Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
272025-09-01T21:46:54Z Script verification uses 15 additional threads
282025-09-01T21:46:54Z Using obfuscation key for blocksdir *.dat files (/Users/lorinc/IdeaProjects/bitcoin/demo/blocks): 'b3658ca56bdb3f0c'
292025-09-01T21:46:54Z Opening LevelDB in /Users/lorinc/IdeaProjects/bitcoin/demo/blocks/index
302025-09-01T21:46:54Z Opened LevelDB successfully
312025-09-01T21:46:54Z Using obfuscation key for /Users/lorinc/IdeaProjects/bitcoin/demo/blocks/index: 0000000000000000
322025-09-01T21:46:54Z Using 16 MiB out of 16 MiB requested for signature cache, able to store 524288 elements
332025-09-01T21:46:54Z Using 16 MiB out of 16 MiB requested for script execution cache, able to store 524288 elements
342025-09-01T21:46:54Z init message: Loading block index…
352025-09-01T21:46:54Z Assuming ancestors of block 00000000000000000001b658dd1120e82e66d2790811f89ede9742ada3ed6d77 have valid signatures.
362025-09-01T21:46:54Z Setting nMinimumChainWork=0000000000000000000000000000000000000000b1f3b93b65b16d035a82be84
372025-09-01T21:46:56Z Loading block index db: last block file = 0
382025-09-01T21:46:56Z Loading block index db: last block file info: CBlockFileInfo(blocks=1030, size=236546, heights=0...1041, time=2009-01-03...2009-01-19)
392025-09-01T21:46:56Z Checking all blk files are present...
402025-09-01T21:46:57Z Initializing chainstate Chainstate [ibd] @ height -1 (null)
412025-09-01T21:46:57Z Opening LevelDB in /Users/lorinc/IdeaProjects/bitcoin/demo/chainstate
422025-09-01T21:46:57Z Opened LevelDB successfully
432025-09-01T21:46:57Z Using obfuscation key for /Users/lorinc/IdeaProjects/bitcoin/demo/chainstate: 49bb7fb91842528b
442025-09-01T21:46:57Z Loaded best chain: hashBestChain=00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09 height=1000 date=2009-01-19T06:34:42Z progress=0.000001
452025-09-01T21:46:57Z init message: Verifying blocks…
462025-09-01T21:46:57Z Verifying last 6 blocks at level 3
472025-09-01T21:46:57Z Verification progress: 0%
482025-09-01T21:46:57Z Verification progress: 16%
492025-09-01T21:46:57Z Verification progress: 33%
502025-09-01T21:46:57Z Verification progress: 50%
512025-09-01T21:46:57Z Verification progress: 66%
522025-09-01T21:46:57Z Verification progress: 83%
532025-09-01T21:46:57Z Verification progress: 99%
542025-09-01T21:46:57Z Verification: No coin database inconsistencies in last 6 blocks (6 transactions)
552025-09-01T21:46:57Z Block index and chainstate loaded
562025-09-01T21:46:57Z Setting NODE_NETWORK on non-prune mode
572025-09-01T21:46:57Z block tree size = 912759
582025-09-01T21:46:57Z nBestHeight = 1000
592025-09-01T21:46:57Z initload thread start
602025-09-01T21:46:57Z mapport thread start
612025-09-01T21:46:57Z torcontrol thread start
622025-09-01T21:46:57Z Disabling signature validations at block [#1001](/bitcoin-bitcoin/1001/) (00000000a2887344f8db859e372e7e4bc26b23b9de340f725afbf2edb265b4c6).
632025-09-01T21:46:57Z UpdateTip: new best=00000000a2887344f8db859e372e7e4bc26b23b9de340f725afbf2edb265b4c6 height=1001 version=0x00000001 log2_work=41.968689 tx=1021 date='2009-01-19T06:49:46Z' progress=0.000001 cache=0.3MiB(1txo)
642025-09-01T21:46:57Z UpdateTip: new best=00000000430a20b3f4f658c153168b6615512dfe1a8362602e44a5e11e83011a height=1002 version=0x00000001 log2_work=41.970128 tx=1022 date='2009-01-19T07:08:26Z' progress=0.000001 cache=0.3MiB(2txo)
652025-09-01T21:46:57Z UpdateTip: new best=000000002d5d8c3264d9c6e352b76430cda7a1edac661a515dd1445c15168de5 height=1003 version=0x00000001 log2_work=41.971566 tx=1023 date='2009-01-19T07:26:12Z' progress=0.000001 cache=0.3MiB(3txo)
662025-09-01T21:46:57Z UpdateTip: new best=00000000aded3a9953bb6acd0f51a99ac433369696116a6b72754c672a350a65 height=1004 version=0x00000001 log2_work=41.973002 tx=1024 date='2009-01-19T07:29:12Z' progress=0.000001 cache=0.3MiB(4txo)
672025-09-01T21:46:57Z UpdateTip: new best=000000006659f6eed8840da4336211802af29eb04453e7e92d0f80a98f3e833c height=1005 version=0x00000001 log2_work=41.974437 tx=1025 date='2009-01-19T07:52:03Z' progress=0.000001 cache=0.3MiB(5txo)
682025-09-01T21:46:57Z UpdateTip: new best=00000000c88cb61c8093f11df65dbc6633ae783e6f51be9aa8bbc6c624a994e2 height=1006 version=0x00000001 log2_work=41.975870 tx=1026 date='2009-01-19T08:11:43Z' progress=0.000001 cache=0.3MiB(6txo)
692025-09-01T21:46:57Z UpdateTip: new best=0000000037b9be6143407617d34d7dd70a09aeb68e5da5a092bf5d19d7a06da6 height=1007 version=0x00000001 log2_work=41.977302 tx=1027 date='2009-01-19T08:27:46Z' progress=0.000001 cache=0.3MiB(7txo)
702025-09-01T21:46:57Z UpdateTip: new best=000000005f7e442c07d918a1f2cd4f594f5e1946c22b06ffd7dfe378f59f70e8 height=1008 version=0x00000001 log2_work=41.978732 tx=1028 date='2009-01-19T08:40:20Z' progress=0.000001 cache=0.3MiB(8txo)
712025-09-01T21:46:57Z UpdateTip: new best=000000008bb80b928343bc65ea33b2c97b722d7b85f0470d32a7519d2b7e5550 height=1009 version=0x00000001 log2_work=41.980162 tx=1029 date='2009-01-19T08:52:17Z' progress=0.000001 cache=0.3MiB(9txo)
722025-09-01T21:46:57Z UpdateTip: new best=0000000074679515061a7e8272f315ca6735ee18105e3d4e867cbc87988e2759 height=1010 version=0x00000001 log2_work=41.981589 tx=1030 date='2009-01-19T08:55:07Z' progress=0.000001 cache=0.3MiB(10txo)
732025-09-01T21:46:57Z UpdateTip: new best=00000000bbafcd3677dc5f3c713f464996e0253a2457828d3e775c83191abefc height=1011 version=0x00000001 log2_work=41.983016 tx=1031 date='2009-01-19T09:09:28Z' progress=0.000001 cache=0.3MiB(11txo)
742025-09-01T21:46:57Z UpdateTip: new best=000000002048a8c44e5fcc9b0f19b2ed1fe2c63842ef88c9a29f54607087dc32 height=1012 version=0x00000001 log2_work=41.984440 tx=1032 date='2009-01-19T09:31:02Z' progress=0.000001 cache=0.3MiB(12txo)
752025-09-01T21:46:57Z UpdateTip: new best=00000000f9c20fdda7029f3d5eda156b6b7d4d2b3b8b850b9dea839483e145b6 height=1013 version=0x00000001 log2_work=41.985864 tx=1033 date='2009-01-19T09:46:28Z' progress=0.000001 cache=0.3MiB(13txo)
762025-09-01T21:46:57Z Loading 0 mempool transactions from file...
772025-09-01T21:46:57Z Imported mempool transactions from file: 0 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast
782025-09-01T21:46:57Z initload thread exit
792025-09-01T21:46:57Z [error] Invalid -i2psam address or hostname: 'invalid_addr'
80Error: Invalid -i2psam address or hostname: 'invalid_addr'
812025-09-01T21:46:57Z tor: Thread interrupt
822025-09-01T21:46:57Z Shutdown in progress...
832025-09-01T21:46:57Z torcontrol thread exit
842025-09-01T21:47:00Z mapport thread exit
852025-09-01T21:47:00Z scheduler thread exit
862025-09-01T21:47:00Z Writing 0 mempool transactions to file...
872025-09-01T21:47:00Z Writing 0 unbroadcast transactions to file.
882025-09-01T21:47:00Z Dumped mempool: 0.000s to copy, 0.009s to dump, 27 bytes dumped to file
892025-09-01T21:47:00Z Flushed fee estimates to fee_estimates.dat.
902025-09-01T21:47:00Z Shutdown done