Merge bitcoin/bitcoin#21866: [Bundle 7/7] validation: Farewell, global Chainstate!
6f994882devalidation: Farewell, global Chainstate! (Carl Dong)972c5166eeqt/test: Reset chainman in ~ChainstateManager instead (Carl Dong)6c3b5dc0c1scripted-diff: tree-wide: Remove all review-only assertions (Carl Dong)3e82abb8ddtree-wide: Remove stray review-only assertion (Carl Dong)f323248abaqt/test: Use existing chainman in ::TestGUI (can be scripted-diff) (Carl Dong)6c15de129cscripted-diff: wallet/test: Use existing chainman (Carl Dong)ee0ab1e959fuzz: Initialize a TestingSetup for test_one_input (Carl Dong)0d61634c06scripted-diff: test: Use existing chainman in unit tests (Carl Dong)e197076219test: Pass in CoinsTip to ValidateCheckInputsForAllFlags (Carl Dong)4d99b61014test/miner_tests: Pass in chain tip to CreateBlockIndex (Carl Dong)f0dd5e6bb4test/util: Use existing chainman in ::PrepareBlock (Carl Dong)464c313e30init: Use existing chainman (Carl Dong) Pull request description: Based on: #21767 à la Mr. Sandman ``` Mr. Chainman, bring me a tip (bung, bung, bung, bung) Make it the most work that I've ever seen (bung, bung, bung, bung) Rewind old tip till we're at the fork point (bung, bung, bung, bung) Then tell it that it's time to call Con-nectTip Chainman, I'm so alone (bung, bung, bung, bung) No local objects to call my own (bung, bung, bung, bung) Please make sure I have a ref Mr. Chainman, bring me a tip! ``` This is the last bundle in the #20158 series. Thanks everyone for their diligent review. I would like to call attention to https://github.com/bitcoin/bitcoin/issues/21766, where a few leftover improvements were collated. - Remove globals: - `ChainstateManager g_chainman` - `CChainState& ChainstateActive()` - `CChain& ChainActive()` - Remove all review-only assertions. ACKs for top commit: jamesob: reACK https://github.com/bitcoin/bitcoin/pull/21866/commits/6f994882deafe62e97f0a889d8bdb8c96dcf913d based on the contents of ariard: Code Review ACK6f99488. jnewbery: utACK6f994882deachow101: Code Review ACK6f994882deryanofsky: Code review ACK6f994882de. Tree-SHA512: 4052ea79360cf0efd81ad0ee3f982e1d93aab1837dcec75f875a56ceda085de078bb3099a2137935d7cc2222004ad88da94b605ef5efef35cb6bc733725debe6
This commit is contained in:
35 files changed
+173
-291
No files matched your search
@@ -85,11 +85,6 @@ void AppTests::appTests()
|
||||
// Reset global state to avoid interfering with later tests.
|
||||
LogInstance().DisconnectTestLogger();
|
||||
AbortShutdown();
|
||||
{
|
||||
LOCK(cs_main);
|
||||
UnloadBlockIndex(/* mempool */ nullptr, g_chainman);
|
||||
g_chainman.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
//! Entry point for BitcoinGUI tests.
|
||||
|
||||
@@ -146,14 +146,14 @@ void TestGUI(interfaces::Node& node)
|
||||
LOCK2(wallet->cs_wallet, spk_man->cs_KeyStore);
|
||||
wallet->SetAddressBook(GetDestinationForKey(test.coinbaseKey.GetPubKey(), wallet->m_default_address_type), "", "receive");
|
||||
spk_man->AddKeyPubKey(test.coinbaseKey, test.coinbaseKey.GetPubKey());
|
||||
wallet->SetLastBlockProcessed(105, ::ChainActive().Tip()->GetBlockHash());
|
||||
wallet->SetLastBlockProcessed(105, node.context()->chainman->ActiveChain().Tip()->GetBlockHash());
|
||||
}
|
||||
{
|
||||
WalletRescanReserver reserver(*wallet);
|
||||
reserver.reserve();
|
||||
CWallet::ScanResult result = wallet->ScanForWalletTransactions(Params().GetConsensus().hashGenesisBlock, 0 /* block height */, {} /* max height */, reserver, true /* fUpdate */);
|
||||
QCOMPARE(result.status, CWallet::ScanResult::SUCCESS);
|
||||
QCOMPARE(result.last_scanned_block, ::ChainActive().Tip()->GetBlockHash());
|
||||
QCOMPARE(result.last_scanned_block, node.context()->chainman->ActiveChain().Tip()->GetBlockHash());
|
||||
QVERIFY(result.last_failed_block.IsNull());
|
||||
}
|
||||
wallet->SetBroadcastTransactions(true);
|
||||
|
||||
Reference in new issue
Block a user