126 const auto tx1 =
make_tx( {m_coinbase_txns[0]}, {10 *
COIN});
132 const auto tx3 =
make_tx( {m_coinbase_txns[1]}, {1099 *
CENT});
138 const auto tx5 =
make_tx( {m_coinbase_txns[2]}, {1099 *
CENT});
147 const auto tx7 =
make_tx( {m_coinbase_txns[3]}, {999 *
CENT});
149 const auto tx8 =
make_tx( {m_coinbase_txns[4]}, {999 *
CENT});
153 const auto tx9 =
make_tx( {m_coinbase_txns[5]}, {995 *
CENT});
155 const auto tx10 =
make_tx( {m_coinbase_txns[6]}, {995 *
CENT});
159 const auto tx11 =
make_tx( {m_coinbase_txns[7]}, {995 *
CENT});
161 const auto tx12 =
make_tx( {m_coinbase_txns[8]}, {995 *
CENT});
165 const auto tx13 =
make_tx( {m_coinbase_txns[9]}, {995 *
CENT, 995 *
CENT});
168 const auto entry1_normal = pool.
GetIter(tx1->GetHash()).value();
169 const auto entry2_normal = pool.
GetIter(tx2->GetHash()).value();
170 const auto entry3_low = pool.
GetIter(tx3->GetHash()).value();
171 const auto entry4_high = pool.
GetIter(tx4->GetHash()).value();
172 const auto entry5_low = pool.
GetIter(tx5->GetHash()).value();
173 const auto entry6_low_prioritised = pool.
GetIter(tx6->GetHash()).value();
174 const auto entry7_high = pool.
GetIter(tx7->GetHash()).value();
175 const auto entry8_high = pool.
GetIter(tx8->GetHash()).value();
176 const auto entry9_unchained = pool.
GetIter(tx9->GetHash()).value();
177 const auto entry10_unchained = pool.
GetIter(tx10->GetHash()).value();
178 const auto entry11_unchained = pool.
GetIter(tx11->GetHash()).value();
179 const auto entry12_unchained = pool.
GetIter(tx12->GetHash()).value();
180 const auto entry13_unchained = pool.
GetIter(tx13->GetHash()).value();
196 entry5_low, entry6_low_prioritised, entry7_high, entry8_high};
204 CFeeRate(entry1_normal->GetModifiedFee() + 1, entry1_normal->GetTxSize() + 2),
205 unused_txid).has_value());
251 const std::vector<CTransactionRef> parent_inputs({m_coinbase_txns[0], m_coinbase_txns[1], m_coinbase_txns[2],
252 m_coinbase_txns[3], m_coinbase_txns[4]});
253 const auto conflicts_with_parents =
make_tx(parent_inputs, {50 *
CENT});
258 all_conflicts) == std::nullopt);
260 auto conflicts_size = all_conflicts.size();
261 all_conflicts.clear();
265 conflicts_size += 23;
267 all_conflicts.clear();
271 conflicts_size += 23;
273 all_conflicts.clear();
277 conflicts_size += 23;
279 all_conflicts.clear();
283 conflicts_size += 23;
286 all_conflicts.clear();
293 const auto spends_unconfirmed =
make_tx({tx1}, {36 *
CENT});
294 for (
const auto& input : spends_unconfirmed->vin) {
300 all_entries) == std::nullopt);
304 const auto spends_new_unconfirmed =
make_tx({tx1, tx8}, {36 *
CENT});
308 const auto spends_conflicting_confirmed =
make_tx({m_coinbase_txns[0], m_coinbase_txns[1]}, {45 *
CENT});
328 const auto entry10_child = pool.
GetIter(child_tx->GetHash()).value();
334 const auto entry10_grand_child = pool.
GetIter(grand_child_tx->GetHash()).value();
341 const auto entry_two_parent_child = pool.
GetIter(two_parent_child_tx->GetHash()).value();
342 BOOST_CHECK_EQUAL(pool.
CheckConflictTopology({entry11_unchained}).value(),
strprintf(
"%s is not the only parent of child %s", entry11_unchained->GetSharedTx()->GetHash().ToString(), entry_two_parent_child->GetSharedTx()->GetHash().ToString()));
343 BOOST_CHECK_EQUAL(pool.
CheckConflictTopology({entry12_unchained}).value(),
strprintf(
"%s is not the only parent of child %s", entry12_unchained->GetSharedTx()->GetHash().ToString(), entry_two_parent_child->GetSharedTx()->GetHash().ToString()));
348 const auto entry_sibling_1 = pool.
GetIter(two_siblings.first->GetHash()).value();
349 const auto entry_sibling_2 = pool.
GetIter(two_siblings.second->GetHash()).value();
350 BOOST_CHECK_EQUAL(pool.
CheckConflictTopology({entry_sibling_1}).value(),
strprintf(
"%s is not the only child of parent %s", entry_sibling_1->GetSharedTx()->GetHash().ToString(), entry13_unchained->GetSharedTx()->GetHash().ToString()));
351 BOOST_CHECK_EQUAL(pool.
CheckConflictTopology({entry_sibling_2}).value(),
strprintf(
"%s is not the only child of parent %s", entry_sibling_2->GetSharedTx()->GetHash().ToString(), entry13_unchained->GetSharedTx()->GetHash().ToString()));
421 const auto low_tx =
make_tx( {m_coinbase_txns[0]}, {10 *
COIN});
424 const auto entry_low = pool.
GetIter(low_tx->GetHash()).value();
425 const auto low_size = entry_low->GetTxSize();
431 std::vector<FeeFrac> expected_old_chunks{{
low_fee, low_size}};
432 BOOST_CHECK(replace_one->first == expected_old_chunks);
433 std::vector<FeeFrac> expected_new_chunks{{0, 1}};
434 BOOST_CHECK(replace_one->second == expected_new_chunks);
441 std::vector<FeeFrac> expected_old_diagram{{
low_fee, low_size}};
442 BOOST_CHECK(replace_one_fee->first == expected_old_diagram);
443 std::vector<FeeFrac> expected_new_diagram{{
high_fee, low_size}};
444 BOOST_CHECK(replace_one_fee->second == expected_new_diagram);
448 const auto high_tx =
make_tx( {low_tx}, {995 *
CENT});
450 const auto entry_high = pool.
GetIter(high_tx->GetHash()).value();
451 const auto high_size = entry_high->GetTxSize();
456 std::vector<FeeFrac> expected_old_chunks{{
low_fee +
high_fee, low_size + high_size}};
457 BOOST_CHECK(replace_single_chunk->first == expected_old_chunks);
458 std::vector<FeeFrac> expected_new_chunks{{
high_fee, low_size}};
459 BOOST_CHECK(replace_single_chunk->second == expected_new_chunks);
466 std::vector<FeeFrac> expected_old_chunks{{
low_fee +
high_fee, low_size + high_size}};
467 BOOST_CHECK(replace_cpfp_child->first == expected_old_chunks);
468 std::vector<FeeFrac> expected_new_chunks{{
high_fee, low_size}, {
low_fee, low_size}};
469 BOOST_CHECK(replace_cpfp_child->second == expected_new_chunks);
473 const auto normal_tx =
make_tx( {high_tx}, {995 *
CENT});
475 const auto entry_normal = pool.
GetIter(normal_tx->GetHash()).value();
476 const auto normal_size = entry_normal->GetTxSize();
479 const auto replace_too_large{pool.
CalculateChunksForRBF(normal_fee, normal_size, {entry_low}, {entry_low, entry_high, entry_normal})};
485 const auto high_tx_2 =
make_tx( {m_coinbase_txns[1]}, {10 *
COIN});
487 const auto entry_high_2 = pool.
GetIter(high_tx_2->GetHash()).value();
488 const auto high_size_2 = entry_high_2->GetTxSize();
490 const auto low_tx_2 =
make_tx( {high_tx_2}, {9 *
COIN});
492 const auto entry_low_2 = pool.
GetIter(low_tx_2->GetHash()).value();
493 const auto low_size_2 = entry_low_2->GetTxSize();
497 BOOST_CHECK(replace_two_chunks_single_cluster.has_value());
498 std::vector<FeeFrac> expected_old_chunks{{
high_fee, high_size_2}, {
low_fee, low_size_2}};
499 BOOST_CHECK(replace_two_chunks_single_cluster->first == expected_old_chunks);
500 std::vector<FeeFrac> expected_new_chunks{{
high_fee, low_size_2}};
501 BOOST_CHECK(replace_two_chunks_single_cluster->second == expected_new_chunks);
505 const auto conflict_1 =
make_tx( {m_coinbase_txns[2]}, {10 *
COIN});
507 const auto conflict_1_entry = pool.
GetIter(conflict_1->GetHash()).value();
509 const auto conflict_2 =
make_tx( {m_coinbase_txns[3]}, {10 *
COIN});
511 const auto conflict_2_entry = pool.
GetIter(conflict_2->GetHash()).value();
513 const auto conflict_3 =
make_tx( {m_coinbase_txns[4]}, {10 *
COIN});
515 const auto conflict_3_entry = pool.
GetIter(conflict_3->GetHash()).value();
518 const auto replace_multiple_clusters{pool.
CalculateChunksForRBF(
high_fee, low_size, {conflict_1_entry, conflict_2_entry, conflict_3_entry}, {conflict_1_entry, conflict_2_entry, conflict_3_entry})};
519 BOOST_CHECK(replace_multiple_clusters.has_value());
520 BOOST_CHECK(replace_multiple_clusters->first.size() == 3);
521 BOOST_CHECK(replace_multiple_clusters->second.size() == 1);
525 const auto conflict_1_child =
make_tx({conflict_1}, {995 *
CENT});
527 const auto conflict_1_child_entry = pool.
GetIter(conflict_1_child->GetHash()).value();
530 const auto replace_multiple_clusters_2{pool.
CalculateChunksForRBF(
high_fee, low_size, {conflict_1_entry, conflict_2_entry, conflict_3_entry}, {conflict_1_entry, conflict_2_entry, conflict_3_entry, conflict_1_child_entry})};
532 BOOST_CHECK(replace_multiple_clusters_2.has_value());
533 BOOST_CHECK(replace_multiple_clusters_2->first.size() == 4);
534 BOOST_CHECK(replace_multiple_clusters_2->second.size() == 1);
538 const auto conflict_1_grand_child =
make_tx({conflict_1_child}, {995 *
CENT});
540 const auto conflict_1_grand_child_entry = pool.
GetIter(conflict_1_child->GetHash()).value();
543 const auto replace_cluster_size_3{pool.
CalculateChunksForRBF(
high_fee, low_size, {conflict_1_entry, conflict_2_entry, conflict_3_entry}, {conflict_1_entry, conflict_2_entry, conflict_3_entry, conflict_1_child_entry, conflict_1_grand_child_entry})};
555 std::vector<FeeFrac> old_chunks{{{950, 300}, {100, 100}}};
556 std::vector<FeeFrac> new_chunks{{{1000, 300}, {50, 100}}};
562 old_chunks = {{950, 300}, {100, 100}};
563 new_chunks = {{1000, 300}, {0, 100}};
569 old_chunks = {{950, 300}, {100, 100}};
570 new_chunks = {{1100, 300}};
577 old_chunks = {{950, 300}, {100, 100}};
578 new_chunks = {{1100, 100}, {0, 100}};
584 old_chunks = {{950, 300}, {100, 100}};
585 new_chunks = {{750, 100}, {249, 250}, {151, 650}};
591 old_chunks = {{950, 300}, {100, 100}};
592 new_chunks = {{750, 100}, {250, 250}, {150, 150}};
598 old_chunks = {{950, 300}, {100, 100}};
599 new_chunks = {{950, 300}, {100, 100}};
605 old_chunks = {{950, 300}, {100, 99}};
606 new_chunks = {{950, 300}, {100, 100}};
613 old_chunks = {{950, 300}, {100, 99}};
614 new_chunks = {{950, 300}, {100, 100}, {0, 1}, {0, 1}};
620 new_chunks = {{950, 300}, {100, 100}, {0, 1}, {0, 1}, {1, 1}};