Skip to content
Bitcoin Roots

v29.4-roots.4 · Commit 3: [PATCH 03/37] policy: restore conservative relay and network controls

src/test/rbf_tests.cpp

Before: src/test/rbf_tests.cpp · After: src/test/rbf_tests.cpp

File metadata
index db328f87412ea4c7f0afb36d051b41ad480a9698..41f24cad1480d4914b1cb7df813ba545a8165acf 100644

Download original patch · Release notes

Diff rows 1–34 of 34. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.

src/test/rbf_tests.cpp CHANGED
@@ -216,18 +216,26 @@ BOOST_FIXTURE_TEST_CASE(rbf_helper_functions, TestChain100Setup)
216
  BOOST_CHECK(PaysMoreThanConflicts(set_34_cpfp, CFeeRate(entry4_high->GetModifiedFee(), entry4_high->GetTxSize()), unused_txid).has_value());
217
 
218
  // Tests for EntriesAndTxidsDisjoint
219
- BOOST_CHECK(EntriesAndTxidsDisjoint(empty_set, {tx1->GetHash()}, unused_txid) == std::nullopt);
220
- BOOST_CHECK(EntriesAndTxidsDisjoint(set_12_normal, {tx3->GetHash()}, unused_txid) == std::nullopt);
221
- BOOST_CHECK(EntriesAndTxidsDisjoint({entry2_normal}, {tx2->GetHash()}, unused_txid).has_value());
222
- BOOST_CHECK(EntriesAndTxidsDisjoint(set_12_normal, {tx1->GetHash()}, unused_txid).has_value());
223
- BOOST_CHECK(EntriesAndTxidsDisjoint(set_12_normal, {tx2->GetHash()}, unused_txid).has_value());
 
 
 
 
 
 
224
  // EntriesAndTxidsDisjoint does not calculate descendants of iters_conflicting; it uses whatever
225
  // the caller passed in. As such, no error is returned even though entry2_normal is a descendant of tx1.
226
- BOOST_CHECK(EntriesAndTxidsDisjoint({entry2_normal}, {tx1->GetHash()}, unused_txid) == std::nullopt);
 
 
227
 
228
  // Tests for PaysForRBF
229
- const CFeeRate incremental_relay_feerate{DEFAULT_INCREMENTAL_RELAY_FEE};
230
- const CFeeRate higher_relay_feerate{2 * DEFAULT_INCREMENTAL_RELAY_FEE};
231
  // Must pay at least as much as the original.
232
  BOOST_CHECK(PaysForRBF(/*original_fees=*/high_fee,
233
  /*replacement_fees=*/high_fee,
 
216
  BOOST_CHECK(PaysMoreThanConflicts(set_34_cpfp, CFeeRate(entry4_high->GetModifiedFee(), entry4_high->GetTxSize()), unused_txid).has_value());
217
 
218
  // Tests for EntriesAndTxidsDisjoint
219
+ bool violates_policy{false};
220
+ BOOST_CHECK(EntriesAndTxidsDisjoint(empty_set, {{tx1->GetHash(), true}}, unused_txid, &violates_policy) == std::nullopt);
221
+ BOOST_CHECK(!violates_policy);
222
+ BOOST_CHECK(EntriesAndTxidsDisjoint(set_12_normal, {{tx3->GetHash(), true}}, unused_txid, &violates_policy) == std::nullopt);
223
+ BOOST_CHECK(!violates_policy);
224
+ BOOST_CHECK(EntriesAndTxidsDisjoint({entry2_normal}, {{tx2->GetHash(), true}}, unused_txid, &violates_policy).has_value());
225
+ BOOST_CHECK(!violates_policy);
226
+ BOOST_CHECK(EntriesAndTxidsDisjoint(set_12_normal, {{tx1->GetHash(), true}}, unused_txid, &violates_policy).has_value());
227
+ BOOST_CHECK(!violates_policy);
228
+ BOOST_CHECK(EntriesAndTxidsDisjoint(set_12_normal, {{tx2->GetHash(), true}}, unused_txid, &violates_policy).has_value());
229
+ BOOST_CHECK(!violates_policy);
230
  // EntriesAndTxidsDisjoint does not calculate descendants of iters_conflicting; it uses whatever
231
  // the caller passed in. As such, no error is returned even though entry2_normal is a descendant of tx1.
232
+ BOOST_CHECK(EntriesAndTxidsDisjoint({entry2_normal}, {{tx1->GetHash(), true}}, unused_txid, &violates_policy) == std::nullopt);
233
+ BOOST_CHECK(!violates_policy);
234
+ // TODO: Add tests for policy-only conflicts
235
 
236
  // Tests for PaysForRBF
237
+ const CFeeRate incremental_relay_feerate{CORE_INCREMENTAL_RELAY_FEE};
238
+ const CFeeRate higher_relay_feerate{2 * incremental_relay_feerate};
239
  // Must pay at least as much as the original.
240
  BOOST_CHECK(PaysForRBF(/*original_fees=*/high_fee,
241
  /*replacement_fees=*/high_fee,