bitcoin/src
Ava Chow 6b73eb9a1a
Merge bitcoin/bitcoin#31064: init: Correct coins db cache size setting
3a4a788ee0 init: Correct coins db cache size setting (TheCharlatan)

Pull request description:

  The chainstate caches are currently re-balanced on startup even in the non-assumeutxo case, leading to the database being needlessly re-opened and its cache re-allocated.

  Similar to `InitCoinsCache` and `m_coinstip_cache_size_bytes`, the `m_coinsdb_cache_size_bytes` should be set in `InitCoinsDB`.

  Together with only conservatively setting the cache values when a assumeutxo chainstate is present, this allows for skipping the cache re-balance during initialization in the normal non-assumeutxo case.

  Before:
  ```
  2024-10-09T21:22:17Z Checking all blk files are present...
  2024-10-09T21:22:17Z Initializing chainstate Chainstate [ibd] @ height -1 (null)
  2024-10-09T21:22:17Z Opening LevelDB in /home/drgrid/.bitcoin/signet/chainstate
  2024-10-09T21:22:17Z Opened LevelDB successfully
  2024-10-09T21:22:17Z Using obfuscation key for /home/drgrid/.bitcoin/signet/chainstate: b0a6f4e95fd05c92
  2024-10-09T21:22:17Z Loaded best chain: hashBestChain=0000000e119967d4937dad58456885ae43fb1761db686947e2f8e168c9a39a4f height=216852 date=2024-10-09T21:06:16Z progress=0.999989
  2024-10-09T21:22:17Z Opening LevelDB in /home/drgrid/.bitcoin/signet/chainstate
  2024-10-09T21:22:17Z Opened LevelDB successfully
  2024-10-09T21:22:17Z Using obfuscation key for /home/drgrid/.bitcoin/signet/chainstate: b0a6f4e95fd05c92
  2024-10-09T21:22:17Z [Chainstate [ibd] @ height 216852 (0000000e119967d4937dad58456885ae43fb1761db686947e2f8e168c9a39a4f)] resized coinsdb cache to 8.0 MiB
  2024-10-09T21:22:17Z [Chainstate [ibd] @ height 216852 (0000000e119967d4937dad58456885ae43fb1761db686947e2f8e168c9a39a4f)] resized coinstip cache to 440.0 MiB
  2024-10-09T21:22:17Z init message: Verifying blocks…
  ```

  After:
  ```
  2024-10-09T21:21:37Z Checking all blk files are present...
  2024-10-09T21:21:37Z Initializing chainstate Chainstate [ibd] @ height -1 (null)
  2024-10-09T21:21:37Z Opening LevelDB in /home/drgrid/.bitcoin/signet/chainstate
  2024-10-09T21:21:37Z Opened LevelDB successfully
  2024-10-09T21:21:37Z Using obfuscation key for /home/drgrid/.bitcoin/signet/chainstate: b0a6f4e95fd05c92
  2024-10-09T21:21:37Z Loaded best chain: hashBestChain=0000012c12b48011a7d9150ce96ed6a44bbf32b09eeecaff4a667789dda2a566 height=216850 date=2024-10-09T20:37:05Z progress=0.999971
  2024-10-09T21:21:37Z init message: Verifying blocks…
  ```

  The change may also be verified by looking at the `feature_assumeutxo.py` functional test debug logs.

ACKs for top commit:
  fjahr:
    utACK 3a4a788ee0
  achow101:
    ACK 3a4a788ee0
  laanwj:
    Code review ACK 3a4a788ee0
  BrandonOdiwuor:
    Code Review ACK 3a4a788ee0

Tree-SHA512: 87878d0d196bb426370d4b4bd180ca52a34017a0799ecea651c2532461fd2927b0f7cc8182276a7d9bb1fe0ede7d0ad677e3714ca22f321917d711c643acc578
2024-10-29 15:12:41 -04:00
..
bench bench: add coverage for wallet migration process 2024-10-21 08:29:22 -03:00
common scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
compat
config
consensus Move BlockMerkleBranch back to merkle.{h,cpp} 2024-09-26 09:48:31 +02:00
crc32c
crypto scripted-diff: drop config/ subdir for bitcoin-config.h, rename to bitcoin-build-config.h 2024-10-10 12:22:12 +02:00
index refactor: Split up NodeContext shutdown_signal and shutdown_request 2024-10-01 09:10:54 +02:00
init scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
interfaces interfaces: remove now unused 'use_upnp' arg from 'mapPort' 2024-10-24 18:23:30 +02:00
ipc Add submitSolution to BlockTemplate interface 2024-09-26 10:04:45 +02:00
kernel cmake: Refactor install kernel dependencies 2024-10-12 16:54:08 +02:00
leveldb
logging scripted-diff: LogPrint -> LogDebug 2024-08-29 13:49:57 +02:00
minisketch
node Merge bitcoin/bitcoin#31064: init: Correct coins db cache size setting 2024-10-29 15:12:41 -04:00
policy fees: Log non-fatal errors as [warning], instead of info-level 2024-10-23 18:43:32 +02:00
primitives
qt scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
rpc Merge bitcoin/bitcoin#31043: rpc: getorphantxs follow-up 2024-10-29 14:49:19 -04:00
script Merge bitcoin/bitcoin#30765: refactor: Allow CScript's operator<< to accept spans, not just vectors 2024-09-20 15:16:53 -04:00
secp256k1 Update secp256k1 subtree to latest master 2024-09-07 18:15:41 +01:00
support
test Merge bitcoin/bitcoin#30110: refactor: TxDownloadManager + fuzzing 2024-10-29 14:41:12 -04:00
univalue build: Remove Autotools-based build system 2024-08-30 21:31:39 +01:00
util scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
wallet scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
zmq cmake: Add FindZeroMQ module 2024-10-25 18:09:36 +01:00
.clang-format
.clang-tidy tidy: add clang-tidy modernize-use-starts-ends-with check 2024-09-14 20:33:32 +03:00
addrdb.cpp scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
addrdb.h
addresstype.cpp
addresstype.h
addrman_impl.h Merge bitcoin/bitcoin#30568: addrman: change internal id counting to int64_t 2024-09-20 12:55:22 -04:00
addrman.cpp scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
addrman.h addrman: change Select to support multiple networks 2024-09-10 12:58:54 -03:00
arith_uint256.cpp
arith_uint256.h
attributes.h
banman.cpp scripted-diff: LogPrint -> LogDebug 2024-08-29 13:49:57 +02:00
banman.h
base58.cpp
base58.h
bech32.cpp fuzz: replace hardcoded numbers for bech32 limits 2024-08-06 11:03:31 +02:00
bech32.h fuzz: replace hardcoded numbers for bech32 limits 2024-08-06 11:03:31 +02:00
bip324.cpp
bip324.h
bitcoin-chainstate.cpp kernel: Move background load thread to node context 2024-09-13 16:10:31 +02:00
bitcoin-cli-res.rc scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
bitcoin-cli.cpp scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
bitcoin-tx-res.rc scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
bitcoin-tx.cpp scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
bitcoin-util-res.rc scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
bitcoin-util.cpp scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
bitcoin-wallet-res.rc scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
bitcoin-wallet.cpp scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
bitcoind-res.rc scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
bitcoind.cpp scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
blockencodings.cpp scripted-diff: LogPrint -> LogDebug 2024-08-29 13:49:57 +02:00
blockencodings.h
blockfilter.cpp
blockfilter.h
chain.cpp
chain.h doc: update NeedsRedownload() comment 2024-09-17 09:54:18 +02:00
chainparams.cpp testnet: Introduce Testnet4 2024-08-06 01:38:10 +02:00
chainparams.h
chainparamsbase.cpp Deduplicate list of chain strings in RPC help texts 2024-08-13 14:00:33 -03:00
chainparamsbase.h Deduplicate list of chain strings in RPC help texts 2024-08-13 14:00:33 -03:00
chainparamsseeds.h seeds: Regenerate mainnet seeds 2024-08-27 07:00:27 +02:00
checkqueue.h
clientversion.cpp scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
clientversion.h scripted-diff: Clarify "user agent" variable name 2024-10-28 12:35:49 +00:00
cluster_linearize.h clusterlin: remove Cluster type 2024-10-07 13:49:36 -04:00
CMakeLists.txt Merge bitcoin/bitcoin#30110: refactor: TxDownloadManager + fuzzing 2024-10-29 14:41:12 -04:00
coins.cpp refactor: Rely on returned value of GetCoin instead of parameter 2024-09-18 20:03:47 +02:00
coins.h refactor: Rely on returned value of GetCoin instead of parameter 2024-09-18 20:03:47 +02:00
compressor.cpp
compressor.h
core_io.h
core_memusage.h
core_read.cpp
core_write.cpp
cuckoocache.h
dbwrapper.cpp scripted-diff: LogPrint -> LogDebug 2024-08-29 13:49:57 +02:00
dbwrapper.h
deploymentinfo.cpp
deploymentinfo.h
deploymentstatus.cpp
deploymentstatus.h
dummywallet.cpp
external_signer.cpp refactor: Remove Span operator==, Use std::ranges::equal 2024-08-13 07:44:31 +02:00
external_signer.h
flatfile.cpp scripted-diff: LogPrint -> LogDebug 2024-08-29 13:49:57 +02:00
flatfile.h
hash.cpp
hash.h
headerssync.cpp scripted-diff: LogPrint -> LogDebug 2024-08-29 13:49:57 +02:00
headerssync.h
httprpc.cpp Merge bitcoin/bitcoin#30401: fix: increase consistency of rpcauth parsing 2024-09-09 12:29:17 -04:00
httprpc.h
httpserver.cpp scripted-diff: drop config/ subdir for bitcoin-config.h, rename to bitcoin-build-config.h 2024-10-10 12:22:12 +02:00
httpserver.h
i2p.cpp
i2p.h
indirectmap.h
init.cpp scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
init.h multiprocess: Add -ipcbind option to bitcoin-node 2024-09-06 09:08:10 -04:00
key_io.cpp
key_io.h
key.cpp
key.h
logging.cpp log: Enforce trailing newline, Remove redundant m_started_new_line 2024-10-01 11:31:39 +02:00
logging.h log: Enforce trailing newline, Remove redundant m_started_new_line 2024-10-01 11:31:39 +02:00
mapport.cpp mapport: remove dead code in DispatchMapPort 2024-10-25 15:02:07 -04:00
mapport.h interfaces: remove now unused 'use_upnp' arg from 'mapPort' 2024-10-24 18:23:30 +02:00
memusage.h
merkleblock.cpp
merkleblock.h
net_permissions.cpp
net_permissions.h
net_processing.cpp [p2p] add TxDownloadOptions bool to make TxRequestTracker deterministic 2024-10-24 21:23:56 -04:00
net_processing.h net: add GetOrphanTransactions() to PeerManager 2024-10-01 21:55:18 -04:00
net_types.cpp
net_types.h
net.cpp scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
net.h daemon: remove UPnP support 2024-10-24 18:23:30 +02:00
netaddress.cpp refactor: Remove Span operator==, Use std::ranges::equal 2024-08-13 07:44:31 +02:00
netaddress.h
netbase.cpp scripted-diff: drop config/ subdir for bitcoin-config.h, rename to bitcoin-build-config.h 2024-10-10 12:22:12 +02:00
netbase.h net: add All() in ReachableNets 2024-09-10 11:20:40 -03:00
netgroup.cpp
netgroup.h
netmessagemaker.h
noui.cpp
noui.h
outputtype.cpp
outputtype.h
pow.cpp Introduce g_fuzzing global for fuzzing checks 2024-10-25 13:12:55 +01:00
pow.h Add FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION in PoW check 2024-09-02 15:43:33 +01:00
prevector.h prevector: avoid GCC bogus warnings in insert method 2024-09-11 17:41:26 +02:00
protocol.cpp
protocol.h
psbt.cpp
psbt.h
pubkey.cpp refactor: Hand-replace some ParseHex -> ""_hex 2024-08-28 19:11:59 +02:00
pubkey.h refactor: Make XOnlyPubKey tolerate constexpr std::arrays 2024-08-28 19:09:51 +02:00
random.cpp Merge bitcoin/bitcoin#31124: util: Remove RandAddSeedPerfmon 2024-10-24 18:08:12 -04:00
random.h util: Remove RandAddSeedPerfmon 2024-10-21 23:24:17 +02:00
randomenv.cpp util: Remove RandAddSeedPerfmon 2024-10-21 23:24:17 +02:00
randomenv.h
rest.cpp scripted-diff: Rename PACKAGE_* variables to CLIENT_* 2024-10-28 12:36:19 +00:00
rest.h
scheduler.cpp
scheduler.h
serialize.h
signet.cpp scripted-diff: LogPrint -> LogDebug 2024-08-29 13:49:57 +02:00
signet.h
span.h refactor: Remove Span operator==, Use std::ranges::equal 2024-08-13 07:44:31 +02:00
streams.cpp streams: remove unused code 2024-09-19 07:33:02 -04:00
streams.h streams: reorder/document functions 2024-09-19 07:57:45 -04:00
sync.cpp
sync.h
threadsafety.h
tinyformat.h
torcontrol.cpp scripted-diff: LogPrint -> LogDebug 2024-08-29 13:49:57 +02:00
torcontrol.h
txdb.cpp refactor: Rely on returned value of GetCoin instead of parameter 2024-09-18 20:03:47 +02:00
txdb.h refactor: Rely on returned value of GetCoin instead of parameter 2024-09-18 20:03:47 +02:00
txmempool.cpp refactor: Rely on returned value of GetCoin instead of parameter 2024-09-18 20:03:47 +02:00
txmempool.h refactor: Rely on returned value of GetCoin instead of parameter 2024-09-18 20:03:47 +02:00
txorphanage.cpp net: add GetOrphanTransactions() to PeerManager 2024-10-01 21:55:18 -04:00
txorphanage.h [fuzz] txdownloadman and txdownload_impl 2024-10-24 21:23:56 -04:00
txrequest.cpp Merge bitcoin/bitcoin#30194: refactor: use recommended type hiding on multi_index types 2024-08-07 20:00:28 +01:00
txrequest.h
uint256.cpp
uint256.h test: remove test-only uint256S 2024-09-06 17:36:18 +02:00
undo.h
validation.cpp Merge bitcoin/bitcoin#31064: init: Correct coins db cache size setting 2024-10-29 15:12:41 -04:00
validation.h Remove unused g_best_block 2024-09-17 09:27:45 +02:00
validationinterface.cpp refactor: include the proper header rather than forward-declaring RemovalReasonToString 2024-10-08 15:25:47 +00:00
validationinterface.h
versionbits.cpp
versionbits.h
walletinitinterface.h