mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Merge bitcoin/bitcoin#23855: refactor: Post-"Chainstate loading sequence coalescence" fixups
e3544c864einit: Use clang-tidy named args syntax (Carl Dong)3401630417style-only: Rename *Chainstate return values (Carl Dong)1dd582782ddocs: Make LoadChainstate comment more accurate (Carl Dong)6b83576388node/chainstate: Use MAX_FUTURE_BLOCK_TIME (Carl Dong) Pull request description: There are 2 proposed fixups in discussions in #23280 which I have not implemented: 1. An overhaul to return types and an option type for the two `*Chainstate` functions: https://github.com/bitcoin/bitcoin/pull/23280#issuecomment-984149564 - The change reintroduces stringy return types and is quite involved. It could be discussed in a separate PR. 2. Passing in the unix time to `VerifyChainstate` instead of a callback to get the time: https://github.com/bitcoin/bitcoin/pull/23280#discussion_r765051533 - I'm not sure it matters much whether it's a callback or just the actual unix time. Also, I think `VerifyDB` can take quite a while, and I don't want to impose that the function have to "run quickly" in order to have it be correct. If reviewers feel strongly about either of the two fixups listed above, please feel free to open a PR based on mine and I'll close this one! ACKs for top commit: ryanofsky: Code review ACKe3544c864eMarcoFalke: ACKe3544c864e🐸 Tree-SHA512: dd1de0265b6785eef306e724b678ce03d7c54ea9f4b5ea0ccd7af59cce2ea3aba73fd4af0c15e2dca9265807dc4075f9afa2ec103672677b6638b1a4fc090904
This commit is contained in:
@@ -182,28 +182,28 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
|
||||
// instead of unit tests, but for now we need these here.
|
||||
RegisterAllCoreRPCCommands(tableRPC);
|
||||
|
||||
auto rv = LoadChainstate(fReindex.load(),
|
||||
*Assert(m_node.chainman.get()),
|
||||
Assert(m_node.mempool.get()),
|
||||
fPruneMode,
|
||||
chainparams.GetConsensus(),
|
||||
m_args.GetBoolArg("-reindex-chainstate", false),
|
||||
m_cache_sizes.block_tree_db,
|
||||
m_cache_sizes.coins_db,
|
||||
m_cache_sizes.coins,
|
||||
true,
|
||||
true);
|
||||
assert(!rv.has_value());
|
||||
auto maybe_load_error = LoadChainstate(fReindex.load(),
|
||||
*Assert(m_node.chainman.get()),
|
||||
Assert(m_node.mempool.get()),
|
||||
fPruneMode,
|
||||
chainparams.GetConsensus(),
|
||||
m_args.GetBoolArg("-reindex-chainstate", false),
|
||||
m_cache_sizes.block_tree_db,
|
||||
m_cache_sizes.coins_db,
|
||||
m_cache_sizes.coins,
|
||||
/*block_tree_db_in_memory=*/true,
|
||||
/*coins_db_in_memory=*/true);
|
||||
assert(!maybe_load_error.has_value());
|
||||
|
||||
auto maybe_verify_failure = VerifyLoadedChainstate(
|
||||
auto maybe_verify_error = VerifyLoadedChainstate(
|
||||
*Assert(m_node.chainman),
|
||||
fReindex.load(),
|
||||
m_args.GetBoolArg("-reindex-chainstate", false),
|
||||
chainparams.GetConsensus(),
|
||||
m_args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS),
|
||||
m_args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL),
|
||||
static_cast<int64_t(*)()>(GetTime));
|
||||
assert(!maybe_verify_failure.has_value());
|
||||
/*get_unix_time_seconds=*/static_cast<int64_t(*)()>(GetTime));
|
||||
assert(!maybe_verify_error.has_value());
|
||||
|
||||
BlockValidationState state;
|
||||
if (!m_node.chainman->ActiveChainstate().ActivateBestChain(state)) {
|
||||
|
||||
Reference in New Issue
Block a user