1717#include < test/util/logging.h>
1818#include < test/util/setup_common.h>
1919
20- using node::BLOCK_SERIALIZATION_HEADER_SIZE ;
20+ using node::STORAGE_HEADER_BYTES ;
2121using node::BlockManager;
2222using node::KernelNotifications;
2323using node::MAX_BLOCKFILE_SIZE;
@@ -40,12 +40,12 @@ BOOST_AUTO_TEST_CASE(blockmanager_find_block_pos)
4040 };
4141 BlockManager blockman{*Assert (m_node.shutdown_signal ), blockman_opts};
4242 // simulate adding a genesis block normally
43- BOOST_CHECK_EQUAL (blockman.WriteBlock (params->GenesisBlock (), 0 ).nPos , BLOCK_SERIALIZATION_HEADER_SIZE );
43+ BOOST_CHECK_EQUAL (blockman.WriteBlock (params->GenesisBlock (), 0 ).nPos , STORAGE_HEADER_BYTES );
4444 // simulate what happens during reindex
4545 // simulate a well-formed genesis block being found at offset 8 in the blk00000.dat file
4646 // the block is found at offset 8 because there is an 8 byte serialization header
4747 // consisting of 4 magic bytes + 4 length bytes before each block in a well-formed blk file.
48- const FlatFilePos pos{0 , BLOCK_SERIALIZATION_HEADER_SIZE };
48+ const FlatFilePos pos{0 , STORAGE_HEADER_BYTES };
4949 blockman.UpdateBlockInfo (params->GenesisBlock (), 0 , pos);
5050 // now simulate what happens after reindex for the first new block processed
5151 // the actual block contents don't matter, just that it's a block.
@@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE(blockmanager_find_block_pos)
5454 // 8 bytes (for serialization header) + 285 (for serialized genesis block) = 293
5555 // add another 8 bytes for the second block's serialization header and we get 293 + 8 = 301
5656 FlatFilePos actual{blockman.WriteBlock (params->GenesisBlock (), 1 )};
57- BOOST_CHECK_EQUAL (actual.nPos , BLOCK_SERIALIZATION_HEADER_SIZE + ::GetSerializeSize (TX_WITH_WITNESS (params->GenesisBlock ())) + BLOCK_SERIALIZATION_HEADER_SIZE );
57+ BOOST_CHECK_EQUAL (actual.nPos , STORAGE_HEADER_BYTES + ::GetSerializeSize (TX_WITH_WITNESS (params->GenesisBlock ())) + STORAGE_HEADER_BYTES );
5858}
5959
6060BOOST_FIXTURE_TEST_CASE (blockmanager_scan_unlink_already_pruned_files, TestChain100Setup)
@@ -172,7 +172,7 @@ BOOST_AUTO_TEST_CASE(blockmanager_flush_block_file)
172172 FlatFilePos pos2{blockman.WriteBlock (block2, /* nHeight=*/ 2 )};
173173
174174 // Two blocks in the file
175- BOOST_CHECK_EQUAL (blockman.CalculateCurrentUsage (), (TEST_BLOCK_SIZE + BLOCK_SERIALIZATION_HEADER_SIZE ) * 2 );
175+ BOOST_CHECK_EQUAL (blockman.CalculateCurrentUsage (), (TEST_BLOCK_SIZE + STORAGE_HEADER_BYTES ) * 2 );
176176
177177 // First two blocks are written as expected
178178 // Errors are expected because block data is junk, thrown AFTER successful read
@@ -199,7 +199,7 @@ BOOST_AUTO_TEST_CASE(blockmanager_flush_block_file)
199199 // Metadata is updated...
200200 BOOST_CHECK_EQUAL (block_data->nBlocks , 3 );
201201 // ...but there are still only two blocks in the file
202- BOOST_CHECK_EQUAL (blockman.CalculateCurrentUsage (), (TEST_BLOCK_SIZE + BLOCK_SERIALIZATION_HEADER_SIZE ) * 2 );
202+ BOOST_CHECK_EQUAL (blockman.CalculateCurrentUsage (), (TEST_BLOCK_SIZE + STORAGE_HEADER_BYTES ) * 2 );
203203
204204 // Block 2 was not overwritten:
205205 blockman.ReadBlock (read_block, pos2);
0 commit comments