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.
501tc = make_tx(/*output_values=*/{2 * COIN}, /*inputs=*/{tb}, /*input_indices=*/{1});502td = make_tx(/*output_values=*/{6 * COIN}, /*inputs=*/{tb, tc}, /*input_indices=*/{0, 0});503TryAddToMempool(pool, entry.Fee(10000LL).FromTx(ta));504TryAddToMempool(pool, entry.Fee(10000LL).FromTx(tb));505TryAddToMempool(pool, entry.Fee(10000LL).FromTx(tc));506TryAddToMempool(pool, entry.Fee(10000LL).FromTx(td));508// Ancestors / descendants should be:509// transaction ancestors descendants510// ============ =================== ===========511// ta 1 (ta 4 (ta,tb,tc,td)512// tb 2 (ta,tb) 4 (ta,tb,tc,td)513// tc 3 (ta,tb,tc) 4 (ta,tb,tc,td)514// td 4 (ta,tb,tc,td) 4 (ta,tb,tc,td)515pool.GetTransactionAncestry(ta->GetHash(), ancestors, descendants);516BOOST_CHECK_EQUAL(ancestors, 1ULL);517BOOST_CHECK_EQUAL(descendants, 4ULL);518pool.GetTransactionAncestry(tb->GetHash(), ancestors, descendants);519BOOST_CHECK_EQUAL(ancestors, 2ULL);520BOOST_CHECK_EQUAL(descendants, 4ULL);521pool.GetTransactionAncestry(tc->GetHash(), ancestors, descendants);522BOOST_CHECK_EQUAL(ancestors, 3ULL);523BOOST_CHECK_EQUAL(descendants, 4ULL);524pool.GetTransactionAncestry(td->GetHash(), ancestors, descendants);525BOOST_CHECK_EQUAL(ancestors, 4ULL);526BOOST_CHECK_EQUAL(descendants, 4ULL);527}529BOOST_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.