mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 09:43:55 +02:00
Return CAutoFile from BlockManager::Open*File()
This is a refactor.
This commit is contained in:
@@ -74,13 +74,13 @@ BOOST_FIXTURE_TEST_CASE(blockmanager_scan_unlink_already_pruned_files, TestChain
|
||||
// Check that the file is not unlinked after ScanAndUnlinkAlreadyPrunedFiles
|
||||
// if m_have_pruned is not yet set
|
||||
WITH_LOCK(chainman->GetMutex(), blockman.ScanAndUnlinkAlreadyPrunedFiles());
|
||||
BOOST_CHECK(!AutoFile(blockman.OpenBlockFile(pos, true)).IsNull());
|
||||
BOOST_CHECK(!blockman.OpenBlockFile(pos, true).IsNull());
|
||||
|
||||
// Check that the file is unlinked after ScanAndUnlinkAlreadyPrunedFiles
|
||||
// once m_have_pruned is set
|
||||
blockman.m_have_pruned = true;
|
||||
WITH_LOCK(chainman->GetMutex(), blockman.ScanAndUnlinkAlreadyPrunedFiles());
|
||||
BOOST_CHECK(AutoFile(blockman.OpenBlockFile(pos, true)).IsNull());
|
||||
BOOST_CHECK(blockman.OpenBlockFile(pos, true).IsNull());
|
||||
|
||||
// Check that calling with already pruned files doesn't cause an error
|
||||
WITH_LOCK(chainman->GetMutex(), blockman.ScanAndUnlinkAlreadyPrunedFiles());
|
||||
@@ -90,7 +90,7 @@ BOOST_FIXTURE_TEST_CASE(blockmanager_scan_unlink_already_pruned_files, TestChain
|
||||
BOOST_CHECK_NE(old_tip, new_tip);
|
||||
const int new_file_number{WITH_LOCK(chainman->GetMutex(), return new_tip->GetBlockPos().nFile)};
|
||||
const FlatFilePos new_pos(new_file_number, 0);
|
||||
BOOST_CHECK(!AutoFile(blockman.OpenBlockFile(new_pos, true)).IsNull());
|
||||
BOOST_CHECK(!blockman.OpenBlockFile(new_pos, true).IsNull());
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(blockmanager_block_data_availability, TestChain100Setup)
|
||||
|
||||
Reference in New Issue
Block a user