mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Require CBlockIndex::GetBlockPos() to hold mutex cs_main
This commit is contained in:
@@ -140,11 +140,13 @@ BOOST_FIXTURE_TEST_CASE(scan_for_wallet_transactions, TestChain100Setup)
|
||||
}
|
||||
|
||||
// Prune the older block file.
|
||||
int file_number;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
Assert(m_node.chainman)->m_blockman.PruneOneBlockFile(oldTip->GetBlockPos().nFile);
|
||||
file_number = oldTip->GetBlockPos().nFile;
|
||||
Assert(m_node.chainman)->m_blockman.PruneOneBlockFile(file_number);
|
||||
}
|
||||
UnlinkPrunedFiles({oldTip->GetBlockPos().nFile});
|
||||
UnlinkPrunedFiles({file_number});
|
||||
|
||||
// Verify ScanForWalletTransactions only picks transactions in the new block
|
||||
// file.
|
||||
@@ -169,9 +171,10 @@ BOOST_FIXTURE_TEST_CASE(scan_for_wallet_transactions, TestChain100Setup)
|
||||
// Prune the remaining block file.
|
||||
{
|
||||
LOCK(cs_main);
|
||||
Assert(m_node.chainman)->m_blockman.PruneOneBlockFile(newTip->GetBlockPos().nFile);
|
||||
file_number = newTip->GetBlockPos().nFile;
|
||||
Assert(m_node.chainman)->m_blockman.PruneOneBlockFile(file_number);
|
||||
}
|
||||
UnlinkPrunedFiles({newTip->GetBlockPos().nFile});
|
||||
UnlinkPrunedFiles({file_number});
|
||||
|
||||
// Verify ScanForWalletTransactions scans no blocks.
|
||||
{
|
||||
@@ -202,11 +205,13 @@ BOOST_FIXTURE_TEST_CASE(importmulti_rescan, TestChain100Setup)
|
||||
CBlockIndex* newTip = m_node.chainman->ActiveChain().Tip();
|
||||
|
||||
// Prune the older block file.
|
||||
int file_number;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
Assert(m_node.chainman)->m_blockman.PruneOneBlockFile(oldTip->GetBlockPos().nFile);
|
||||
file_number = oldTip->GetBlockPos().nFile;
|
||||
Assert(m_node.chainman)->m_blockman.PruneOneBlockFile(file_number);
|
||||
}
|
||||
UnlinkPrunedFiles({oldTip->GetBlockPos().nFile});
|
||||
UnlinkPrunedFiles({file_number});
|
||||
|
||||
// Verify importmulti RPC returns failure for a key whose creation time is
|
||||
// before the missing block, and success for a key whose creation time is
|
||||
|
||||
Reference in New Issue
Block a user