Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
501new_chunks = {{1100, 300}};503BOOST_CHECK(std::is_lt(CompareChunks(old_chunks, new_chunks)));504BOOST_CHECK(std::is_gt(CompareChunks(new_chunks, old_chunks)));506// New diagram is strictly better due to the first chunk, even though507// second chunk contributes no fees508old_chunks = {{950, 300}, {100, 100}};509new_chunks = {{1100, 100}, {0, 100}};511BOOST_CHECK(std::is_lt(CompareChunks(old_chunks, new_chunks)));512BOOST_CHECK(std::is_gt(CompareChunks(new_chunks, old_chunks)));514// Feerate of first new chunk is better with, but second chunk is worse515old_chunks = {{950, 300}, {100, 100}};516new_chunks = {{750, 100}, {249, 250}, {151, 650}};518BOOST_CHECK(CompareChunks(old_chunks, new_chunks) == std::partial_ordering::unordered);519BOOST_CHECK(CompareChunks(new_chunks, old_chunks) == std::partial_ordering::unordered);521// If we make the second chunk slightly better, the new diagram now wins.522old_chunks = {{950, 300}, {100, 100}};523new_chunks = {{750, 100}, {250, 250}, {150, 150}};525BOOST_CHECK(std::is_lt(CompareChunks(old_chunks, new_chunks)));526BOOST_CHECK(std::is_gt(CompareChunks(new_chunks, old_chunks)));528// Identical diagrams, cannot be strictly better529old_chunks = {{950, 300}, {100, 100}};530new_chunks = {{950, 300}, {100, 100}};532BOOST_CHECK(std::is_eq(CompareChunks(old_chunks, new_chunks)));533BOOST_CHECK(std::is_eq(CompareChunks(new_chunks, old_chunks)));535// Same aggregate fee, but different total size (trigger single tail fee check step)536old_chunks = {{950, 300}, {100, 99}};537new_chunks = {{950, 300}, {100, 100}};539// No change in evaluation when tail check needed.540BOOST_CHECK(std::is_gt(CompareChunks(old_chunks, new_chunks)));541BOOST_CHECK(std::is_lt(CompareChunks(new_chunks, old_chunks)));543// Trigger multiple tail fee check steps544old_chunks = {{950, 300}, {100, 99}};545new_chunks = {{950, 300}, {100, 100}, {0, 1}, {0, 1}};547BOOST_CHECK(std::is_gt(CompareChunks(old_chunks, new_chunks)));548BOOST_CHECK(std::is_lt(CompareChunks(new_chunks, old_chunks)));550// Multiple tail fee check steps, unordered result551new_chunks = {{950, 300}, {100, 100}, {0, 1}, {0, 1}, {1, 1}};552BOOST_CHECK(CompareChunks(old_chunks, new_chunks) == std::partial_ordering::unordered);553BOOST_CHECK(CompareChunks(new_chunks, old_chunks) == std::partial_ordering::unordered);554}556BOOST_AUTO_TEST_SUITE_END()
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.