Skip to content

Commit f93f9b9

Browse files
committed
Merge #10144: Prioritisetransaction wasn't always updating ancestor fee
9bef02e Bugfix: ancestor modifed fees were incorrect for descendants (Suhas Daftuar) ba7dd8b Test prioritisetransaction and ancestor fee state (Suhas Daftuar) Tree-SHA512: 01977d88e1afb093a003f22a6f29ea60df3d70a179fe7e55910b9c8c340c4af9fb20cdc804c40235b62c43c453f0194eda0d0d4dbd365d2d98347f5dbe5de01c
2 parents 5fc6a77 + 9bef02e commit f93f9b9

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/txmempool.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,13 @@ void CTxMemPool::PrioritiseTransaction(const uint256& hash, const CAmount& nFeeD
912912
BOOST_FOREACH(txiter ancestorIt, setAncestors) {
913913
mapTx.modify(ancestorIt, update_descendant_state(0, nFeeDelta, 0));
914914
}
915+
// Now update all descendants' modified fees with ancestors
916+
setEntries setDescendants;
917+
CalculateDescendants(it, setDescendants);
918+
setDescendants.erase(it);
919+
BOOST_FOREACH(txiter descendantIt, setDescendants) {
920+
mapTx.modify(descendantIt, update_ancestor_state(0, nFeeDelta, 0, 0));
921+
}
915922
}
916923
}
917924
LogPrintf("PrioritiseTransaction: %s feerate += %s\n", hash.ToString(), FormatMoney(nFeeDelta));

test/functional/mempool_packages.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,18 @@ def run_test(self):
101101
assert_equal(mempool[x], v_descendants[x])
102102
assert(chain[0] not in v_descendants.keys())
103103

104+
# Check that ancestor modified fees includes fee deltas from
105+
# prioritisetransaction
106+
self.nodes[0].prioritisetransaction(chain[0], 1000)
107+
mempool = self.nodes[0].getrawmempool(True)
108+
ancestor_fees = 0
109+
for x in chain:
110+
ancestor_fees += mempool[x]['fee']
111+
assert_equal(mempool[x]['ancestorfees'], ancestor_fees * COIN + 1000)
112+
113+
# Undo the prioritisetransaction for later tests
114+
self.nodes[0].prioritisetransaction(chain[0], -1000)
115+
104116
# Check that descendant modified fees includes fee deltas from
105117
# prioritisetransaction
106118
self.nodes[0].prioritisetransaction(chain[-1], 1000)

0 commit comments

Comments
 (0)