diff options
author | Suhas Daftuar <sdaftuar@gmail.com> | 2018-01-12 12:40:55 -0500 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@gmail.com> | 2018-01-12 12:40:55 -0500 |
commit | 7abfa538b5a4508e0cf0589ae3ac0620b2188912 (patch) | |
tree | eb2c89f3cdbee7258304ba0d24e3c548595546a4 /src | |
parent | 9a51319578091234fdd218a1eb144d517ea82b85 (diff) |
Add test for new ancestor feerate sort behavior
Diffstat (limited to 'src')
-rw-r--r-- | src/test/mempool_tests.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/mempool_tests.cpp b/src/test/mempool_tests.cpp index f56f341498..e6234c5abf 100644 --- a/src/test/mempool_tests.cpp +++ b/src/test/mempool_tests.cpp @@ -427,6 +427,23 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest) sortedOrder.erase(sortedOrder.end()-2); sortedOrder.insert(sortedOrder.begin(), tx7.GetHash().ToString()); CheckSort<ancestor_score>(pool, sortedOrder); + + // High-fee parent, low-fee child + // tx7 -> tx8 + CMutableTransaction tx8 = CMutableTransaction(); + tx8.vin.resize(1); + tx8.vin[0].prevout = COutPoint(tx7.GetHash(), 0); + tx8.vin[0].scriptSig = CScript() << OP_11; + tx8.vout.resize(1); + tx8.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; + tx8.vout[0].nValue = 10*COIN; + + // Check that we sort by min(feerate, ancestor_feerate): + // set the fee so that the ancestor feerate is above tx1/5, + // but the transaction's own feerate is lower + pool.addUnchecked(tx8.GetHash(), entry.Fee(5000LL).FromTx(tx8)); + sortedOrder.insert(sortedOrder.end()-1, tx8.GetHash().ToString()); + CheckSort<ancestor_score>(pool, sortedOrder); } |