Branch data Line data Source code
1 : : // Copyright (c) 2021-present The Bitcoin Core developers
2 : : // Distributed under the MIT software license, see the accompanying
3 : : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 : : #include <common/system.h>
5 : : #include <policy/rbf.h>
6 : : #include <random.h>
7 : : #include <test/util/txmempool.h>
8 : : #include <txmempool.h>
9 : : #include <util/time.h>
10 : :
11 : : #include <test/util/common.h>
12 : : #include <test/util/setup_common.h>
13 : :
14 : : #include <boost/test/unit_test.hpp>
15 : : #include <optional>
16 : : #include <vector>
17 : :
18 : : BOOST_FIXTURE_TEST_SUITE(rbf_tests, BasicTestingSetup)
19 : :
20 : 1150 : static inline CTransactionRef make_tx(const std::vector<CTransactionRef>& inputs,
21 : : const std::vector<CAmount>& output_values)
22 : : {
23 : 1150 : CMutableTransaction tx = CMutableTransaction();
24 [ - + + - ]: 1150 : tx.vin.resize(inputs.size());
25 [ - + + - ]: 1150 : tx.vout.resize(output_values.size());
26 [ - + + + ]: 2303 : for (size_t i = 0; i < inputs.size(); ++i) {
27 [ + - ]: 1153 : tx.vin[i].prevout.hash = inputs[i]->GetHash();
28 : 1153 : tx.vin[i].prevout.n = 0;
29 : : // Add a witness so wtxid != txid
30 [ + - + - : 2306 : tx.vin[i].scriptWitness = CScriptWitness{{std::vector<unsigned char>(i + 10)}};
- + - + +
+ - - ]
31 : : }
32 [ - + + + ]: 2401 : for (size_t i = 0; i < output_values.size(); ++i) {
33 [ + - + - ]: 1251 : tx.vout[i].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
34 : 1251 : tx.vout[i].nValue = output_values[i];
35 : : }
36 [ + - ]: 2300 : return MakeTransactionRef(tx);
37 [ + - ]: 2303 : }
38 : :
39 : 102 : static CTransactionRef add_descendants(const CTransactionRef& tx, int32_t num_descendants, CTxMemPool& pool)
40 : : EXCLUSIVE_LOCKS_REQUIRED(::cs_main, pool.cs)
41 : : {
42 : 102 : AssertLockHeld(::cs_main);
43 : 102 : AssertLockHeld(pool.cs);
44 : 102 : TestMemPoolEntryHelper entry;
45 : : // Assumes this isn't already spent in mempool
46 [ + - ]: 102 : auto tx_to_spend = tx;
47 [ + + ]: 1122 : for (int32_t i{0}; i < num_descendants; ++i) {
48 [ + - + - : 4080 : auto next_tx = make_tx(/*inputs=*/{tx_to_spend}, /*output_values=*/{(50 - i) * CENT});
+ + + - +
- - - -
- ]
49 [ + - + - ]: 1020 : TryAddToMempool(pool, entry.FromTx(next_tx));
50 [ + - + - : 2040 : BOOST_CHECK(pool.GetIter(next_tx->GetHash()).has_value());
+ - ]
51 [ + - ]: 1020 : tx_to_spend = next_tx;
52 : 1020 : }
53 : : // Return last created tx
54 : 102 : return tx_to_spend;
55 [ + - + - ]: 2040 : }
56 : :
57 [ + - + - : 7 : BOOST_FIXTURE_TEST_CASE(rbf_helper_functions, TestChain100Setup)
+ - + - -
+ + - + -
+ - + - +
- + - - +
+ - + - +
- + - + -
+ - - + +
- + - + -
+ - + - +
- + - - +
+ - + - +
- + - + -
+ - - + +
- ]
58 : : {
59 : 1 : CTxMemPool& pool = *Assert(m_node.mempool);
60 [ + - ]: 1 : LOCK2(::cs_main, pool.cs);
61 : 1 : TestMemPoolEntryHelper entry;
62 : :
63 : 1 : const CAmount low_fee{CENT/100};
64 : 1 : const CAmount normal_fee{CENT/10};
65 : 1 : const CAmount high_fee{CENT};
66 : :
67 : : // Create a parent tx1 and child tx2 with normal fees:
68 [ + - + - : 4 : const auto tx1 = make_tx(/*inputs=*/ {m_coinbase_txns[0]}, /*output_values=*/ {10 * COIN});
+ - + + +
- + - - -
- - ]
69 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(normal_fee).FromTx(tx1));
70 [ + - + - : 4 : const auto tx2 = make_tx(/*inputs=*/ {tx1}, /*output_values=*/ {995 * CENT});
+ + + - +
- - - -
- ]
71 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(normal_fee).FromTx(tx2));
72 : :
73 : : // Create a low-feerate parent tx3 and high-feerate child tx4 (cpfp)
74 [ + - + - : 4 : const auto tx3 = make_tx(/*inputs=*/ {m_coinbase_txns[1]}, /*output_values=*/ {1099 * CENT});
+ - + + +
- + - - -
- - ]
75 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(low_fee).FromTx(tx3));
76 [ + - + - : 4 : const auto tx4 = make_tx(/*inputs=*/ {tx3}, /*output_values=*/ {999 * CENT});
+ + + - +
- - - -
- ]
77 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(high_fee).FromTx(tx4));
78 : :
79 : : // Create a parent tx5 and child tx6 where both have very low fees
80 [ + - + - : 4 : const auto tx5 = make_tx(/*inputs=*/ {m_coinbase_txns[2]}, /*output_values=*/ {1099 * CENT});
+ - + + +
- + - - -
- - ]
81 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(low_fee).FromTx(tx5));
82 [ + - + - : 4 : const auto tx6 = make_tx(/*inputs=*/ {tx5}, /*output_values=*/ {1098 * CENT});
+ + + - +
- - - -
- ]
83 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(low_fee).FromTx(tx6));
84 : : // Make tx6's modified fee much higher than its base fee. This should cause it to pass
85 : : // the fee-related checks despite being low-feerate.
86 [ + - ]: 1 : pool.PrioritiseTransaction(tx6->GetHash(), 1 * COIN);
87 : :
88 : : // Two independent high-feerate transactions, tx7 and tx8
89 [ + - + - : 4 : const auto tx7 = make_tx(/*inputs=*/ {m_coinbase_txns[3]}, /*output_values=*/ {999 * CENT});
+ - + + +
- + - - -
- - ]
90 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(high_fee).FromTx(tx7));
91 [ + - + - : 4 : const auto tx8 = make_tx(/*inputs=*/ {m_coinbase_txns[4]}, /*output_values=*/ {999 * CENT});
+ - + + +
- + - - -
- - ]
92 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(high_fee).FromTx(tx8));
93 : :
94 : : // Will make these two parents of single child
95 [ + - + - : 4 : const auto tx11 = make_tx(/*inputs=*/ {m_coinbase_txns[7]}, /*output_values=*/ {995 * CENT});
+ - + + +
- + - - -
- - ]
96 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(normal_fee).FromTx(tx11));
97 [ + - + - : 4 : const auto tx12 = make_tx(/*inputs=*/ {m_coinbase_txns[8]}, /*output_values=*/ {995 * CENT});
+ - + + +
- + - - -
- - ]
98 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(normal_fee).FromTx(tx12));
99 : :
100 : : // Will make two children of this single parent
101 [ + - + - : 4 : const auto tx13 = make_tx(/*inputs=*/ {m_coinbase_txns[9]}, /*output_values=*/ {995 * CENT, 995 * CENT});
+ - + + +
- + - - -
- - ]
102 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(normal_fee).FromTx(tx13));
103 : :
104 [ + - ]: 1 : const auto entry1_normal = pool.GetIter(tx1->GetHash()).value();
105 [ + - ]: 1 : const auto entry2_normal = pool.GetIter(tx2->GetHash()).value();
106 [ + - ]: 1 : const auto entry3_low = pool.GetIter(tx3->GetHash()).value();
107 [ + - ]: 1 : const auto entry4_high = pool.GetIter(tx4->GetHash()).value();
108 [ + - ]: 1 : const auto entry5_low = pool.GetIter(tx5->GetHash()).value();
109 [ + - ]: 1 : const auto entry6_low_prioritised = pool.GetIter(tx6->GetHash()).value();
110 [ + - ]: 1 : const auto entry7_high = pool.GetIter(tx7->GetHash()).value();
111 [ + - ]: 1 : const auto entry8_high = pool.GetIter(tx8->GetHash()).value();
112 : :
113 [ + - + - ]: 1 : BOOST_CHECK_EQUAL(entry1_normal->GetFee(), normal_fee);
114 [ + - + - ]: 1 : BOOST_CHECK_EQUAL(entry2_normal->GetFee(), normal_fee);
115 [ + - + - ]: 1 : BOOST_CHECK_EQUAL(entry3_low->GetFee(), low_fee);
116 [ + - + - ]: 1 : BOOST_CHECK_EQUAL(entry4_high->GetFee(), high_fee);
117 [ + - + - ]: 1 : BOOST_CHECK_EQUAL(entry5_low->GetFee(), low_fee);
118 [ + - + - ]: 1 : BOOST_CHECK_EQUAL(entry6_low_prioritised->GetFee(), low_fee);
119 [ + - + - ]: 1 : BOOST_CHECK_EQUAL(entry7_high->GetFee(), high_fee);
120 [ + - + - ]: 1 : BOOST_CHECK_EQUAL(entry8_high->GetFee(), high_fee);
121 : :
122 [ + - ]: 1 : CTxMemPool::setEntries set_12_normal{entry1_normal, entry2_normal};
123 : 1 : CTxMemPool::setEntries empty_set;
124 : :
125 [ + - ]: 1 : const auto unused_txid = Txid::FromUint256(GetRandHash());
126 : :
127 : : // Tests for EntriesAndTxidsDisjoint
128 [ + - + - : 2 : BOOST_CHECK(EntriesAndTxidsDisjoint(empty_set, {tx1->GetHash()}, unused_txid) == std::nullopt);
+ - + - +
- ]
129 [ + - + - : 2 : BOOST_CHECK(EntriesAndTxidsDisjoint(set_12_normal, {tx3->GetHash()}, unused_txid) == std::nullopt);
+ - + - +
- ]
130 [ + - + - : 2 : BOOST_CHECK(EntriesAndTxidsDisjoint({entry2_normal}, {tx2->GetHash()}, unused_txid).has_value());
+ - + - +
- + - ]
131 [ + - + - : 2 : BOOST_CHECK(EntriesAndTxidsDisjoint(set_12_normal, {tx1->GetHash()}, unused_txid).has_value());
+ - + - +
- ]
132 [ + - + - : 2 : BOOST_CHECK(EntriesAndTxidsDisjoint(set_12_normal, {tx2->GetHash()}, unused_txid).has_value());
+ - + - +
- ]
133 : : // EntriesAndTxidsDisjoint does not calculate descendants of iters_conflicting; it uses whatever
134 : : // the caller passed in. As such, no error is returned even though entry2_normal is a descendant of tx1.
135 [ + - + - : 2 : BOOST_CHECK(EntriesAndTxidsDisjoint({entry2_normal}, {tx1->GetHash()}, unused_txid) == std::nullopt);
+ - + - +
- + - ]
136 : :
137 : : // Tests for PaysForRBF
138 : 1 : const CFeeRate incremental_relay_feerate{DEFAULT_INCREMENTAL_RELAY_FEE};
139 : 1 : const CFeeRate higher_relay_feerate{2 * DEFAULT_INCREMENTAL_RELAY_FEE};
140 : : // Must pay at least as much as the original.
141 [ + - + - : 2 : BOOST_CHECK(PaysForRBF(/*original_fees=*/high_fee,
+ - + - ]
142 : : /*replacement_fees=*/high_fee,
143 : : /*replacement_vsize=*/1,
144 : : /*relay_fee=*/CFeeRate(0),
145 : : /*txid=*/unused_txid)
146 : : == std::nullopt);
147 [ + - + - : 2 : BOOST_CHECK(PaysForRBF(high_fee, high_fee - 1, 1, CFeeRate(0), unused_txid).has_value());
+ - + - ]
148 [ + - + - : 2 : BOOST_CHECK(PaysForRBF(high_fee + 1, high_fee, 1, CFeeRate(0), unused_txid).has_value());
+ - + - ]
149 : : // Additional fees must cover the replacement's vsize at incremental relay fee
150 [ + - + - : 2 : BOOST_CHECK(PaysForRBF(high_fee, high_fee + 1, 11, incremental_relay_feerate, unused_txid).has_value());
+ - + - ]
151 [ + - + - : 2 : BOOST_CHECK(PaysForRBF(high_fee, high_fee + 1, 10, incremental_relay_feerate, unused_txid) == std::nullopt);
+ - + - ]
152 [ + - + - : 2 : BOOST_CHECK(PaysForRBF(high_fee, high_fee + 2, 11, higher_relay_feerate, unused_txid).has_value());
+ - + - ]
153 [ + - + - : 2 : BOOST_CHECK(PaysForRBF(high_fee, high_fee + 4, 20, higher_relay_feerate, unused_txid) == std::nullopt);
+ - + - ]
154 [ + - + - : 2 : BOOST_CHECK(PaysForRBF(low_fee, high_fee, 99999999, incremental_relay_feerate, unused_txid).has_value());
+ - + - ]
155 [ + - + - : 2 : BOOST_CHECK(PaysForRBF(low_fee, high_fee + 99999999, 99999999, incremental_relay_feerate, unused_txid) == std::nullopt);
+ - ]
156 [ + - + - : 28 : }
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - + - +
- + - +
- ]
157 : :
158 [ + - + - : 7 : BOOST_FIXTURE_TEST_CASE(rbf_conflicts_calculator, TestChain100Setup)
+ - + - -
+ + - + -
+ - + - +
- + - - +
+ - + - +
- + - + -
+ - - + +
- + - + -
+ - + - +
- + - - +
+ - + - +
- + - + -
+ - - + +
- ]
159 : : {
160 : 1 : CTxMemPool& pool = *Assert(m_node.mempool);
161 [ + - ]: 1 : LOCK2(::cs_main, pool.cs);
162 : 1 : TestMemPoolEntryHelper entry;
163 : :
164 : 1 : const CAmount normal_fee{CENT/10};
165 : :
166 : : // Create two parent transactions with 51 outputs each
167 : 1 : const int NUM_OUTPUTS = 51;
168 : 1 : std::vector<CAmount> output_values;
169 [ + - ]: 1 : output_values.reserve(NUM_OUTPUTS);
170 [ + + ]: 52 : for (int i = 0; i < NUM_OUTPUTS; ++i) {
171 [ + - ]: 51 : output_values.push_back(1 * COIN);
172 : : }
173 : :
174 [ + - + - : 3 : const auto parent_tx_1 = make_tx(/*inputs=*/ {m_coinbase_txns[0]}, /*output_values=*/ output_values);
+ + + - -
- - - ]
175 [ + - + - : 3 : const auto parent_tx_2 = make_tx(/*inputs=*/ {m_coinbase_txns[1]}, /*output_values=*/ output_values);
+ + + - +
- - - - -
- - ]
176 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(normal_fee).FromTx(parent_tx_1));
177 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(normal_fee).FromTx(parent_tx_2));
178 : :
179 : 1 : std::vector<CTransactionRef> direct_children;
180 : :
181 : : // Create individual spends of these outputs
182 [ + - + - : 9 : for (const auto& parent_tx : {parent_tx_1, parent_tx_2}) {
+ + + - -
- ]
183 [ + + ]: 104 : for (auto i = 0; i < NUM_OUTPUTS; ++i) {
184 [ + - + - : 408 : auto pretx = make_tx(/*inputs=*/ {parent_tx}, /*output_values=*/ {995 * CENT});
+ + + - +
- - - -
- ]
185 [ + - ]: 102 : CMutableTransaction tx(*pretx);
186 [ + - ]: 102 : tx.vin[0].prevout.n = i;
187 [ + - + - ]: 102 : TryAddToMempool(pool, entry.Fee(normal_fee).FromTx(tx));
188 [ + - + - : 204 : BOOST_CHECK(pool.GetIter(tx.GetHash()).has_value());
+ - + - +
- ]
189 [ + - + - : 204 : direct_children.push_back(MakeTransactionRef(tx));
- + ]
190 [ + - ]: 204 : }
191 [ + + - - ]: 3 : }
192 : :
193 : : // At this point, we should have 2 clusters in the mempool, each with 52
194 : : // transactions.
195 : :
196 : : // parent_tx and all children are in one cluster, so we can have as many
197 : : // conflicts within this cluster as we want without violating the RBF conflicts
198 : : // limit.
199 [ + - ]: 1 : const auto parent_entry_1 = pool.GetIter(parent_tx_1->GetHash()).value();
200 [ + - ]: 1 : const auto parent_entry_2 = pool.GetIter(parent_tx_2->GetHash()).value();
201 [ + - + - : 5 : const auto conflicting_transaction = make_tx({parent_tx_1, parent_tx_2}, {50 * CENT});
+ + + - +
- - - -
- ]
202 [ + - ]: 1 : CTxMemPool::setEntries all_conflicts, dummy;
203 [ + - + - : 2 : BOOST_CHECK(GetEntriesForConflicts(/*tx=*/ *conflicting_transaction.get(),
+ - + - ]
204 : : /*pool=*/ pool,
205 : : /*iters_conflicting=*/ {parent_entry_1, parent_entry_2},
206 : : /*all_conflicts=*/ all_conflicts) == std::nullopt);
207 : :
208 : 1 : dummy.clear();
209 : : // Conflicting directly with all those conflicts doesn't change anything.
210 [ + - + - : 2 : BOOST_CHECK(GetEntriesForConflicts(/*tx=*/ *conflicting_transaction.get(),
+ - + - ]
211 : : /*pool=*/ pool,
212 : : /*iters_conflicting=*/ all_conflicts,
213 : : /*all_conflicts=*/ dummy) == std::nullopt);
214 [ + - + - ]: 1 : BOOST_CHECK_EQUAL(all_conflicts.size(), dummy.size());
215 : 1 : dummy.clear();
216 : :
217 : : // If we mine the parent_tx's, then the clusters split (102 clusters).
218 [ + - + + : 3 : pool.removeForBlock({parent_tx_1, parent_tx_2});
+ - - - -
- ]
219 : :
220 : : // Add some descendants now to each of the direct children (we can do this now that the clusters have split).
221 [ + + ]: 103 : for (const auto& child : direct_children) {
222 [ + - ]: 204 : add_descendants(child, 10, pool);
223 : : }
224 : :
225 : : // We can conflict with 100 different clusters, even if they have lots of transactions.
226 : 1 : CTxMemPool::setEntries conflicts;
227 [ + + ]: 101 : for (auto i = 0; i < 100; ++i) {
228 [ + - + - ]: 200 : conflicts.insert(pool.GetIter(direct_children[i]->GetHash()).value());
229 : : }
230 [ + - + - : 2 : BOOST_CHECK(GetEntriesForConflicts(/*tx=*/ *conflicting_transaction.get(),
+ - + - ]
231 : : /*pool=*/ pool,
232 : : /*iters_conflicting=*/ conflicts,
233 : : /*all_conflicts=*/ dummy) == std::nullopt);
234 : :
235 : : // Conflicting with 1 more distinct cluster causes failure, however.
236 [ + - + - ]: 2 : conflicts.insert(pool.GetIter(direct_children[100]->GetHash()).value());
237 [ + - + - : 2 : BOOST_CHECK(GetEntriesForConflicts(/*tx=*/ *conflicting_transaction.get(),
+ - ]
238 : : /*pool=*/ pool,
239 : : /*iters_conflicting=*/ conflicts,
240 : : /*all_conflicts=*/ dummy).has_value());
241 [ + - + - : 218 : }
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - + - +
- ]
242 : :
243 [ + - + - : 7 : BOOST_FIXTURE_TEST_CASE(improves_feerate, TestChain100Setup)
+ - + - -
+ + - + -
+ - + - +
- + - - +
+ - + - +
- + - + -
+ - - + +
- + - + -
+ - + - +
- + - - +
+ - + - +
- + - + -
+ - - + +
- ]
244 : : {
245 : 1 : CTxMemPool& pool = *Assert(m_node.mempool);
246 [ + - ]: 1 : LOCK2(::cs_main, pool.cs);
247 : 1 : TestMemPoolEntryHelper entry;
248 : :
249 : 1 : const CAmount low_fee{CENT/100};
250 : 1 : const CAmount normal_fee{CENT/10};
251 : :
252 : : // low feerate parent with normal feerate child
253 [ + - + - : 5 : const auto tx1 = make_tx(/*inputs=*/ {m_coinbase_txns[0], m_coinbase_txns[1]}, /*output_values=*/ {10 * COIN});
+ - + + +
- + - - -
- - ]
254 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(low_fee).FromTx(tx1));
255 [ + - + - : 4 : const auto tx2 = make_tx(/*inputs=*/ {tx1}, /*output_values=*/ {995 * CENT});
+ + + - +
- - - -
- ]
256 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(normal_fee).FromTx(tx2));
257 : :
258 [ + - ]: 1 : const auto entry1 = pool.GetIter(tx1->GetHash()).value();
259 [ + - ]: 1 : const auto tx1_fee = entry1->GetModifiedFee();
260 [ + - ]: 1 : const auto entry2 = pool.GetIter(tx2->GetHash()).value();
261 [ + - ]: 1 : const auto tx2_fee = entry2->GetModifiedFee();
262 : :
263 : : // conflicting transactions
264 [ + - + - : 5 : const auto tx1_conflict = make_tx(/*inputs=*/ {m_coinbase_txns[0], m_coinbase_txns[2]}, /*output_values=*/ {10 * COIN});
+ - + + +
- + - - -
- - ]
265 [ + - + - : 4 : const auto tx3 = make_tx(/*inputs=*/ {tx1_conflict}, /*output_values=*/ {995 * CENT});
+ + + - +
- - - -
- ]
266 [ + - ]: 1 : auto entry3 = entry.FromTx(tx3);
267 : :
268 : : // Now test ImprovesFeerateDiagram with various levels of "package rbf" feerates
269 : :
270 : : // It doesn't improve itself
271 : 1 : {
272 [ + - ]: 1 : auto changeset{pool.GetChangeSet()};
273 [ + - ]: 1 : changeset->StageRemoval(entry1);
274 [ + - ]: 1 : changeset->StageRemoval(entry2);
275 [ + - ]: 1 : changeset->StageAddition(tx1_conflict, tx1_fee, 0, 1, 0, false, 4, LockPoints());
276 [ + - ]: 1 : changeset->StageAddition(tx3, tx2_fee, 0, 1, 0, false, 4, LockPoints());
277 [ + - ]: 1 : const auto res1 = ImprovesFeerateDiagram(*changeset);
278 [ + - + - : 2 : BOOST_CHECK(res1.has_value());
+ - ]
279 [ + - + - : 2 : BOOST_CHECK(res1.value().first == DiagramCheckError::FAILURE);
+ - + - ]
280 [ + - + - : 2 : BOOST_CHECK(res1.value().second == "insufficient feerate: does not improve feerate diagram");
+ - ]
281 : 1 : }
282 : :
283 : : // With one more satoshi it does
284 : 1 : {
285 [ + - ]: 1 : auto changeset{pool.GetChangeSet()};
286 [ + - ]: 1 : changeset->StageRemoval(entry1);
287 [ + - ]: 1 : changeset->StageRemoval(entry2);
288 [ + - ]: 1 : changeset->StageAddition(tx1_conflict, tx1_fee + 1, 0, 1, 0, false, 4, LockPoints());
289 [ + - ]: 1 : changeset->StageAddition(tx3, tx2_fee, 0, 1, 0, false, 4, LockPoints());
290 [ + - + - : 2 : BOOST_CHECK(ImprovesFeerateDiagram(*changeset) == std::nullopt);
+ - ]
291 : 0 : }
292 : :
293 : : // With prioritisation of in-mempool conflicts, it affects the results of the comparison using the same args as just above
294 [ + - + - ]: 2 : pool.PrioritiseTransaction(entry1->GetSharedTx()->GetHash(), /*nFeeDelta=*/1);
295 : 1 : {
296 [ + - ]: 1 : auto changeset{pool.GetChangeSet()};
297 [ + - ]: 1 : changeset->StageRemoval(entry1);
298 [ + - ]: 1 : changeset->StageRemoval(entry2);
299 [ + - ]: 1 : changeset->StageAddition(tx1_conflict, tx1_fee + 1, 0, 1, 0, false, 4, LockPoints());
300 [ + - ]: 1 : changeset->StageAddition(tx3, tx2_fee, 0, 1, 0, false, 4, LockPoints());
301 [ + - ]: 1 : const auto res2 = ImprovesFeerateDiagram(*changeset);
302 [ + - + - : 2 : BOOST_CHECK(res2.has_value());
+ - ]
303 [ + - + - : 2 : BOOST_CHECK(res2.value().first == DiagramCheckError::FAILURE);
+ - + - ]
304 [ + - + - : 2 : BOOST_CHECK(res2.value().second == "insufficient feerate: does not improve feerate diagram");
+ - ]
305 : 1 : }
306 [ + - + - ]: 2 : pool.PrioritiseTransaction(entry1->GetSharedTx()->GetHash(), /*nFeeDelta=*/-1);
307 : :
308 : : // With fewer vbytes it does
309 [ + - ]: 1 : CMutableTransaction tx4{entry3.GetTx()};
310 [ + - + - ]: 2 : tx4.vin[0].scriptWitness = CScriptWitness(); // Clear out the witness, to reduce size
311 [ + - + - ]: 2 : auto entry4 = entry.FromTx(MakeTransactionRef(tx4));
312 : 1 : {
313 [ + - ]: 1 : auto changeset{pool.GetChangeSet()};
314 [ + - ]: 1 : changeset->StageRemoval(entry1);
315 [ + - ]: 1 : changeset->StageRemoval(entry2);
316 [ + - ]: 1 : changeset->StageAddition(tx1_conflict, tx1_fee, 0, 1, 0, false, 4, LockPoints());
317 [ + - + - ]: 2 : changeset->StageAddition(entry4.GetSharedTx(), tx2_fee, 0, 1, 0, false, 4, LockPoints());
318 [ + - + - : 2 : BOOST_CHECK(ImprovesFeerateDiagram(*changeset) == std::nullopt);
+ - ]
319 : 0 : }
320 : :
321 : : // Adding a grandchild makes the cluster size 3, which is also calculable
322 [ + - + - : 4 : const auto tx5 = make_tx(/*inputs=*/{tx2}, /*output_values=*/{995 * CENT});
+ + + - +
- - - -
- ]
323 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(normal_fee).FromTx(tx5));
324 [ + - ]: 1 : const auto entry5 = pool.GetIter(tx5->GetHash()).value();
325 : 1 : {
326 [ + - ]: 1 : auto changeset{pool.GetChangeSet()};
327 [ + - ]: 1 : changeset->StageRemoval(entry1);
328 [ + - ]: 1 : changeset->StageRemoval(entry2);
329 [ + - ]: 1 : changeset->StageRemoval(entry5);
330 [ + - ]: 1 : changeset->StageAddition(tx1_conflict, tx1_fee, 0, 1, 0, false, 4, LockPoints());
331 [ + - + - ]: 2 : changeset->StageAddition(entry4.GetSharedTx(), tx2_fee + entry5->GetModifiedFee() + 1, 0, 1, 0, false, 4, LockPoints());
332 [ + - ]: 1 : const auto res3 = ImprovesFeerateDiagram(*changeset);
333 [ + - + - ]: 2 : BOOST_CHECK(res3 == std::nullopt);
334 [ + - ]: 1 : }
335 [ + - + - : 18 : }
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - + - +
- + - ]
336 : :
337 [ + - + - : 7 : BOOST_FIXTURE_TEST_CASE(calc_feerate_diagram_rbf, TestChain100Setup)
+ - + - -
+ + - + -
+ - + - +
- + - - +
+ - + - +
- + - + -
+ - - + +
- + - + -
+ - + - +
- + - - +
+ - + - +
- + - + -
+ - - + +
- ]
338 : : {
339 : 1 : CTxMemPool& pool = *Assert(m_node.mempool);
340 [ + - ]: 1 : LOCK2(::cs_main, pool.cs);
341 : 1 : TestMemPoolEntryHelper entry;
342 : :
343 : 1 : const CAmount low_fee{CENT/100};
344 : 1 : const CAmount high_fee{CENT};
345 : :
346 : : // low -> high -> medium fee transactions that would result in two chunks together since they
347 : : // are all same size
348 [ + - + - : 4 : const auto low_tx = make_tx(/*inputs=*/ {m_coinbase_txns[0]}, /*output_values=*/ {10 * COIN});
+ - + + +
- + - - -
- - ]
349 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(low_fee).FromTx(low_tx));
350 : :
351 [ + - ]: 1 : const auto entry_low = pool.GetIter(low_tx->GetHash()).value();
352 [ + - ]: 1 : const auto low_size = entry_low->GetAdjustedWeight();
353 : :
354 [ + - + - : 4 : const auto replacement_tx = make_tx(/*inputs=*/ {m_coinbase_txns[0]}, /*output_values=*/ {9 * COIN});
+ - + + +
- + - - -
- - ]
355 [ + - ]: 1 : auto entry_replacement = entry.FromTx(replacement_tx);
356 : :
357 : : // Replacement of size 1
358 : 1 : {
359 [ + - ]: 1 : auto changeset = pool.GetChangeSet();
360 [ + - ]: 1 : changeset->StageRemoval(entry_low);
361 [ + - ]: 1 : changeset->StageAddition(replacement_tx, 0, 0, 1, 0, false, 4, LockPoints());
362 [ + - ]: 1 : const auto replace_one{changeset->CalculateChunksForRBF()};
363 [ + - + - : 2 : BOOST_CHECK(replace_one.has_value());
+ - ]
364 [ + - ]: 1 : std::vector<FeeFrac> expected_old_chunks{{low_fee, low_size}};
365 [ + - + - : 2 : BOOST_CHECK_EQUAL_COLLECTIONS(replace_one->first.begin(), replace_one->first.end(),
+ - + - ]
366 : : expected_old_chunks.begin(), expected_old_chunks.end());
367 [ + - + - ]: 1 : std::vector<FeeFrac> expected_new_chunks{{0, entry_replacement.GetAdjustedWeight()}};
368 [ + - + - : 2 : BOOST_CHECK_EQUAL_COLLECTIONS(replace_one->second.begin(), replace_one->second.end(),
+ - ]
369 : : expected_new_chunks.begin(), expected_new_chunks.end());
370 : 1 : }
371 : :
372 : : // Non-zero replacement fee/size
373 : 1 : {
374 [ + - ]: 1 : auto changeset = pool.GetChangeSet();
375 [ + - ]: 1 : changeset->StageRemoval(entry_low);
376 [ + - ]: 1 : changeset->StageAddition(replacement_tx, high_fee, 0, 1, 0, false, 4, LockPoints());
377 [ + - ]: 1 : const auto replace_one_fee{changeset->CalculateChunksForRBF()};
378 [ + - + - : 2 : BOOST_CHECK(replace_one_fee.has_value());
+ - ]
379 [ + - ]: 1 : std::vector<FeeFrac> expected_old_diagram{{low_fee, low_size}};
380 [ + - + - : 2 : BOOST_CHECK_EQUAL_COLLECTIONS(replace_one_fee->first.begin(), replace_one_fee->first.end(),
+ - + - ]
381 : : expected_old_diagram.begin(), expected_old_diagram.end());
382 [ + - + - ]: 1 : std::vector<FeeFrac> expected_new_diagram{{high_fee, entry_replacement.GetAdjustedWeight()}};
383 [ + - + - : 2 : BOOST_CHECK_EQUAL_COLLECTIONS(replace_one_fee->second.begin(), replace_one_fee->second.end(),
+ - ]
384 : : expected_new_diagram.begin(), expected_new_diagram.end());
385 : 1 : }
386 : :
387 : : // Add a second transaction to the cluster that will make a single chunk, to be evicted in the RBF
388 [ + - + - : 4 : const auto high_tx = make_tx(/*inputs=*/ {low_tx}, /*output_values=*/ {995 * CENT});
+ + + - +
- - - -
- ]
389 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(high_fee).FromTx(high_tx));
390 [ + - ]: 1 : const auto entry_high = pool.GetIter(high_tx->GetHash()).value();
391 [ + - ]: 1 : const auto high_size = entry_high->GetAdjustedWeight();
392 : :
393 : 1 : {
394 [ + - ]: 1 : auto changeset = pool.GetChangeSet();
395 [ + - ]: 1 : changeset->StageRemoval(entry_low);
396 [ + - ]: 1 : changeset->StageRemoval(entry_high);
397 [ + - ]: 1 : changeset->StageAddition(replacement_tx, high_fee, 0, 1, 0, false, 4, LockPoints());
398 [ + - ]: 1 : const auto replace_single_chunk{changeset->CalculateChunksForRBF()};
399 [ + - + - : 2 : BOOST_CHECK(replace_single_chunk.has_value());
+ - ]
400 [ + - ]: 1 : std::vector<FeeFrac> expected_old_chunks{{low_fee + high_fee, low_size + high_size}};
401 [ + - + - : 2 : BOOST_CHECK_EQUAL_COLLECTIONS(replace_single_chunk->first.begin(), replace_single_chunk->first.end(),
+ - + - ]
402 : : expected_old_chunks.begin(), expected_old_chunks.end());
403 [ + - + - ]: 1 : std::vector<FeeFrac> expected_new_chunks{{high_fee, entry_replacement.GetAdjustedWeight()}};
404 [ + - + - : 2 : BOOST_CHECK_EQUAL_COLLECTIONS(replace_single_chunk->second.begin(), replace_single_chunk->second.end(),
+ - ]
405 : : expected_new_chunks.begin(), expected_new_chunks.end());
406 : 1 : }
407 : :
408 : : // Conflict with the 2nd tx, resulting in new diagram with three entries
409 : 1 : {
410 [ + - ]: 1 : auto changeset = pool.GetChangeSet();
411 [ + - ]: 1 : changeset->StageRemoval(entry_high);
412 [ + - ]: 1 : changeset->StageAddition(replacement_tx, high_fee, 0, 1, 0, false, 4, LockPoints());
413 [ + - ]: 1 : const auto replace_cpfp_child{changeset->CalculateChunksForRBF()};
414 [ + - + - : 2 : BOOST_CHECK(replace_cpfp_child.has_value());
+ - ]
415 [ + - ]: 1 : std::vector<FeeFrac> expected_old_chunks{{low_fee + high_fee, low_size + high_size}};
416 [ + - + - : 2 : BOOST_CHECK_EQUAL_COLLECTIONS(replace_cpfp_child->first.begin(), replace_cpfp_child->first.end(),
+ - + - ]
417 : : expected_old_chunks.begin(), expected_old_chunks.end());
418 [ + - + - ]: 1 : std::vector<FeeFrac> expected_new_chunks{{high_fee, entry_replacement.GetAdjustedWeight()}, {low_fee, low_size}};
419 [ + - + - : 2 : BOOST_CHECK_EQUAL_COLLECTIONS(replace_cpfp_child->second.begin(), replace_cpfp_child->second.end(),
+ - ]
420 : : expected_new_chunks.begin(), expected_new_chunks.end());
421 : 1 : }
422 : :
423 : : // Make a size 2 cluster that is itself two chunks; evict both txns
424 [ + - + - : 4 : const auto high_tx_2 = make_tx(/*inputs=*/ {m_coinbase_txns[1]}, /*output_values=*/ {10 * COIN});
+ - + + +
- + - - -
- - ]
425 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(high_fee).FromTx(high_tx_2));
426 [ + - ]: 1 : const auto entry_high_2 = pool.GetIter(high_tx_2->GetHash()).value();
427 [ + - ]: 1 : const auto high_size_2 = entry_high_2->GetAdjustedWeight();
428 : :
429 [ + - + - : 4 : const auto low_tx_2 = make_tx(/*inputs=*/ {high_tx_2}, /*output_values=*/ {9 * COIN});
+ + + - +
- - - -
- ]
430 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(low_fee).FromTx(low_tx_2));
431 [ + - ]: 1 : const auto entry_low_2 = pool.GetIter(low_tx_2->GetHash()).value();
432 [ + - ]: 1 : const auto low_size_2 = entry_low_2->GetAdjustedWeight();
433 : :
434 : 1 : {
435 [ + - ]: 1 : auto changeset = pool.GetChangeSet();
436 [ + - ]: 1 : changeset->StageRemoval(entry_high_2);
437 [ + - ]: 1 : changeset->StageRemoval(entry_low_2);
438 [ + - ]: 1 : changeset->StageAddition(replacement_tx, high_fee, 0, 1, 0, false, 4, LockPoints());
439 [ + - ]: 1 : const auto replace_two_chunks_single_cluster{changeset->CalculateChunksForRBF()};
440 [ + - + - : 2 : BOOST_CHECK(replace_two_chunks_single_cluster.has_value());
+ - ]
441 [ + - ]: 1 : std::vector<FeeFrac> expected_old_chunks{{high_fee, high_size_2}, {low_fee, low_size_2}};
442 [ + - + - : 2 : BOOST_CHECK_EQUAL_COLLECTIONS(replace_two_chunks_single_cluster->first.begin(), replace_two_chunks_single_cluster->first.end(),
+ - + - ]
443 : : expected_old_chunks.begin(), expected_old_chunks.end());
444 [ + - ]: 1 : std::vector<FeeFrac> expected_new_chunks{{high_fee, low_size_2}};
445 [ + - + - : 2 : BOOST_CHECK_EQUAL_COLLECTIONS(replace_two_chunks_single_cluster->second.begin(), replace_two_chunks_single_cluster->second.end(),
+ - ]
446 : : expected_new_chunks.begin(), expected_new_chunks.end());
447 : 1 : }
448 : :
449 : : // You can have more than two direct conflicts
450 [ + - + - : 4 : const auto conflict_1 = make_tx(/*inputs=*/ {m_coinbase_txns[2]}, /*output_values=*/ {10 * COIN});
+ - + + +
- + - - -
- - ]
451 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(low_fee).FromTx(conflict_1));
452 [ + - ]: 1 : const auto conflict_1_entry = pool.GetIter(conflict_1->GetHash()).value();
453 : :
454 [ + - + - : 4 : const auto conflict_2 = make_tx(/*inputs=*/ {m_coinbase_txns[3]}, /*output_values=*/ {10 * COIN});
+ - + + +
- + - - -
- - ]
455 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(low_fee).FromTx(conflict_2));
456 [ + - ]: 1 : const auto conflict_2_entry = pool.GetIter(conflict_2->GetHash()).value();
457 : :
458 [ + - + - : 4 : const auto conflict_3 = make_tx(/*inputs=*/ {m_coinbase_txns[4]}, /*output_values=*/ {10 * COIN});
+ - + + +
- + - - -
- - ]
459 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(low_fee).FromTx(conflict_3));
460 [ + - ]: 1 : const auto conflict_3_entry = pool.GetIter(conflict_3->GetHash()).value();
461 : :
462 : 1 : {
463 [ + - ]: 1 : auto changeset = pool.GetChangeSet();
464 [ + - ]: 1 : changeset->StageRemoval(conflict_1_entry);
465 [ + - ]: 1 : changeset->StageRemoval(conflict_2_entry);
466 [ + - ]: 1 : changeset->StageRemoval(conflict_3_entry);
467 [ + - ]: 1 : changeset->StageAddition(replacement_tx, high_fee, 0, 1, 0, false, 4, LockPoints());
468 [ + - ]: 1 : const auto replace_multiple_clusters{changeset->CalculateChunksForRBF()};
469 [ + - + - : 2 : BOOST_CHECK(replace_multiple_clusters.has_value());
+ - ]
470 [ + - - + : 2 : BOOST_CHECK(replace_multiple_clusters->first.size() == 3);
+ - + - ]
471 [ + - - + : 2 : BOOST_CHECK(replace_multiple_clusters->second.size() == 1);
+ - ]
472 : 1 : }
473 : :
474 : : // Add a child transaction to conflict_1 and make it cluster size 2, two chunks due to same feerate
475 [ + - + - : 4 : const auto conflict_1_child = make_tx(/*inputs=*/{conflict_1}, /*output_values=*/ {995 * CENT});
+ + + - +
- - - -
- ]
476 [ + - + - ]: 1 : TryAddToMempool(pool, entry.Fee(low_fee).FromTx(conflict_1_child));
477 [ + - ]: 1 : const auto conflict_1_child_entry = pool.GetIter(conflict_1_child->GetHash()).value();
478 : :
479 : 1 : {
480 [ + - ]: 1 : auto changeset = pool.GetChangeSet();
481 [ + - ]: 1 : changeset->StageRemoval(conflict_1_entry);
482 [ + - ]: 1 : changeset->StageRemoval(conflict_2_entry);
483 [ + - ]: 1 : changeset->StageRemoval(conflict_3_entry);
484 [ + - ]: 1 : changeset->StageRemoval(conflict_1_child_entry);
485 [ + - ]: 1 : changeset->StageAddition(replacement_tx, high_fee, 0, 1, 0, false, 4, LockPoints());
486 [ + - ]: 1 : const auto replace_multiple_clusters_2{changeset->CalculateChunksForRBF()};
487 : :
488 [ + - + - : 2 : BOOST_CHECK(replace_multiple_clusters_2.has_value());
+ - ]
489 [ + - - + : 2 : BOOST_CHECK(replace_multiple_clusters_2->first.size() == 4);
+ - + - ]
490 [ + - - + : 2 : BOOST_CHECK(replace_multiple_clusters_2->second.size() == 1);
+ - ]
491 [ + - ]: 1 : }
492 [ + - + - : 23 : }
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - + - +
- + - +
- ]
493 : :
494 [ + - + - : 7 : BOOST_AUTO_TEST_CASE(feerate_chunks_utilities)
+ - + - -
+ + - + -
+ - + - +
- + - - +
+ - + - +
- + - + -
+ - - + +
- + - + -
+ - + - +
- + - - +
+ - + - +
- + - + -
+ - - + +
- ]
495 : : {
496 : : // Sanity check the correctness of the feerate chunks comparison.
497 : :
498 : : // A strictly better case.
499 : 1 : std::vector<FeeFrac> old_chunks{{{950, 300}, {100, 100}}};
500 [ + - ]: 1 : std::vector<FeeFrac> new_chunks{{{1000, 300}, {50, 100}}};
501 : :
502 [ + - - + : 2 : BOOST_CHECK(std::is_lt(CompareChunks(old_chunks, new_chunks)));
- + + - +
- + - ]
503 [ + - - + : 2 : BOOST_CHECK(std::is_gt(CompareChunks(new_chunks, old_chunks)));
- + + - +
- + - ]
504 : :
505 : : // Incomparable diagrams
506 [ + - ]: 1 : old_chunks = {{950, 300}, {100, 100}};
507 [ + - ]: 1 : new_chunks = {{1000, 300}, {0, 100}};
508 : :
509 [ + - - + : 3 : BOOST_CHECK(CompareChunks(old_chunks, new_chunks) == std::partial_ordering::unordered);
- + + - +
- + - ]
510 [ + - - + : 3 : BOOST_CHECK(CompareChunks(new_chunks, old_chunks) == std::partial_ordering::unordered);
- + + - +
- + - ]
511 : :
512 : : // Strictly better but smaller size.
513 [ + - ]: 1 : old_chunks = {{950, 300}, {100, 100}};
514 [ + - ]: 1 : new_chunks = {{1100, 300}};
515 : :
516 [ + - - + : 2 : BOOST_CHECK(std::is_lt(CompareChunks(old_chunks, new_chunks)));
- + + - +
- + - ]
517 [ + - - + : 2 : BOOST_CHECK(std::is_gt(CompareChunks(new_chunks, old_chunks)));
- + + - +
- + - ]
518 : :
519 : : // New diagram is strictly better due to the first chunk, even though
520 : : // second chunk contributes no fees
521 [ + - ]: 1 : old_chunks = {{950, 300}, {100, 100}};
522 [ + - ]: 1 : new_chunks = {{1100, 100}, {0, 100}};
523 : :
524 [ + - - + : 2 : BOOST_CHECK(std::is_lt(CompareChunks(old_chunks, new_chunks)));
- + + - +
- + - ]
525 [ + - - + : 2 : BOOST_CHECK(std::is_gt(CompareChunks(new_chunks, old_chunks)));
- + + - +
- + - ]
526 : :
527 : : // Feerate of first new chunk is better with, but second chunk is worse
528 [ + - ]: 1 : old_chunks = {{950, 300}, {100, 100}};
529 [ + - ]: 1 : new_chunks = {{750, 100}, {249, 250}, {151, 650}};
530 : :
531 [ + - - + : 3 : BOOST_CHECK(CompareChunks(old_chunks, new_chunks) == std::partial_ordering::unordered);
- + + - +
- + - ]
532 [ + - - + : 3 : BOOST_CHECK(CompareChunks(new_chunks, old_chunks) == std::partial_ordering::unordered);
- + + - +
- + - ]
533 : :
534 : : // If we make the second chunk slightly better, the new diagram now wins.
535 [ + - ]: 1 : old_chunks = {{950, 300}, {100, 100}};
536 [ + - ]: 1 : new_chunks = {{750, 100}, {250, 250}, {150, 150}};
537 : :
538 [ + - - + : 2 : BOOST_CHECK(std::is_lt(CompareChunks(old_chunks, new_chunks)));
- + + - +
- + - ]
539 [ + - - + : 2 : BOOST_CHECK(std::is_gt(CompareChunks(new_chunks, old_chunks)));
- + + - +
- + - ]
540 : :
541 : : // Identical diagrams, cannot be strictly better
542 [ + - ]: 1 : old_chunks = {{950, 300}, {100, 100}};
543 [ + - ]: 1 : new_chunks = {{950, 300}, {100, 100}};
544 : :
545 [ + - - + : 2 : BOOST_CHECK(std::is_eq(CompareChunks(old_chunks, new_chunks)));
- + + - +
- + - ]
546 [ + - - + : 2 : BOOST_CHECK(std::is_eq(CompareChunks(new_chunks, old_chunks)));
- + + - +
- + - ]
547 : :
548 : : // Same aggregate fee, but different total size (trigger single tail fee check step)
549 [ + - ]: 1 : old_chunks = {{950, 300}, {100, 99}};
550 [ + - ]: 1 : new_chunks = {{950, 300}, {100, 100}};
551 : :
552 : : // No change in evaluation when tail check needed.
553 [ + - - + : 2 : BOOST_CHECK(std::is_gt(CompareChunks(old_chunks, new_chunks)));
- + + - +
- + - ]
554 [ + - - + : 2 : BOOST_CHECK(std::is_lt(CompareChunks(new_chunks, old_chunks)));
- + + - +
- + - ]
555 : :
556 : : // Trigger multiple tail fee check steps
557 [ + - ]: 1 : old_chunks = {{950, 300}, {100, 99}};
558 [ + - ]: 1 : new_chunks = {{950, 300}, {100, 100}, {0, 1}, {0, 1}};
559 : :
560 [ + - - + : 2 : BOOST_CHECK(std::is_gt(CompareChunks(old_chunks, new_chunks)));
- + + - +
- + - ]
561 [ + - - + : 2 : BOOST_CHECK(std::is_lt(CompareChunks(new_chunks, old_chunks)));
- + + - +
- + - ]
562 : :
563 : : // Multiple tail fee check steps, unordered result
564 [ + - ]: 1 : new_chunks = {{950, 300}, {100, 100}, {0, 1}, {0, 1}, {1, 1}};
565 [ + - - + : 3 : BOOST_CHECK(CompareChunks(old_chunks, new_chunks) == std::partial_ordering::unordered);
- + + - +
- + - ]
566 [ + - - + : 3 : BOOST_CHECK(CompareChunks(new_chunks, old_chunks) == std::partial_ordering::unordered);
- + + - +
- ]
567 : 1 : }
568 : :
569 : : BOOST_AUTO_TEST_SUITE_END()
|