Skip to content

Commit 7abfa53

Browse files
committed
Add test for new ancestor feerate sort behavior
1 parent 9a51319 commit 7abfa53

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/test/mempool_tests.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,23 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
427427
sortedOrder.erase(sortedOrder.end()-2);
428428
sortedOrder.insert(sortedOrder.begin(), tx7.GetHash().ToString());
429429
CheckSort<ancestor_score>(pool, sortedOrder);
430+
431+
// High-fee parent, low-fee child
432+
// tx7 -> tx8
433+
CMutableTransaction tx8 = CMutableTransaction();
434+
tx8.vin.resize(1);
435+
tx8.vin[0].prevout = COutPoint(tx7.GetHash(), 0);
436+
tx8.vin[0].scriptSig = CScript() << OP_11;
437+
tx8.vout.resize(1);
438+
tx8.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
439+
tx8.vout[0].nValue = 10*COIN;
440+
441+
// Check that we sort by min(feerate, ancestor_feerate):
442+
// set the fee so that the ancestor feerate is above tx1/5,
443+
// but the transaction's own feerate is lower
444+
pool.addUnchecked(tx8.GetHash(), entry.Fee(5000LL).FromTx(tx8));
445+
sortedOrder.insert(sortedOrder.end()-1, tx8.GetHash().ToString());
446+
CheckSort<ancestor_score>(pool, sortedOrder);
430447
}
431448

432449

0 commit comments

Comments
 (0)