|
31 | 31 | #include <optional> |
32 | 32 | #include <ranges> |
33 | 33 |
|
34 | | -struct update_fee_delta |
35 | | -{ |
36 | | - explicit update_fee_delta(int64_t _feeDelta) : feeDelta(_feeDelta) { } |
37 | | - |
38 | | - void operator() (CTxMemPoolEntry &e) { e.UpdateModifiedFee(feeDelta); } |
39 | | - |
40 | | -private: |
41 | | - int64_t feeDelta; |
42 | | -}; |
43 | | - |
44 | 34 | bool TestLockPointValidity(CChain& active_chain, const LockPoints& lp) |
45 | 35 | { |
46 | 36 | AssertLockHeld(cs_main); |
@@ -77,11 +67,11 @@ CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef& tx, CAmount fee, |
77 | 67 | nModFeesWithAncestors{nFee}, |
78 | 68 | nSigOpCountWithAncestors{sigOpCount} {} |
79 | 69 |
|
80 | | -void CTxMemPoolEntry::UpdateModifiedFee(int64_t fee_diff) |
| 70 | +void CTxMemPoolEntry::UpdateModifiedFee(CAmount newFeeDelta) |
81 | 71 | { |
82 | | - nModFeesWithDescendants = SaturatingAdd(nModFeesWithDescendants, fee_diff); |
83 | | - nModFeesWithAncestors = SaturatingAdd(nModFeesWithAncestors, fee_diff); |
84 | | - m_modified_fee = SaturatingAdd(m_modified_fee, fee_diff); |
| 72 | + nModFeesWithDescendants = SaturatingAdd(nModFeesWithDescendants, newFeeDelta); |
| 73 | + nModFeesWithAncestors = SaturatingAdd(nModFeesWithAncestors, newFeeDelta); |
| 74 | + m_modified_fee = SaturatingAdd(m_modified_fee, newFeeDelta); |
85 | 75 | } |
86 | 76 |
|
87 | 77 | void CTxMemPoolEntry::UpdateLockPoints(const LockPoints& lp) |
@@ -485,7 +475,7 @@ void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAnces |
485 | 475 | // The following call to UpdateModifiedFee assumes no previous fee modifications |
486 | 476 | Assume(entry.GetFee() == entry.GetModifiedFee()); |
487 | 477 | if (delta) { |
488 | | - mapTx.modify(newit, update_fee_delta(delta)); |
| 478 | + mapTx.modify(newit, [&delta](CTxMemPoolEntry& e) { e.UpdateModifiedFee(delta); }); |
489 | 479 | } |
490 | 480 |
|
491 | 481 | // Update cachedInnerUsage to include contained transaction's usage. |
@@ -1449,7 +1439,7 @@ void CTxMemPool::PrioritiseTransaction(const uint256& hash, const CAmount& nFeeD |
1449 | 1439 | delta = SaturatingAdd(delta, nFeeDelta); |
1450 | 1440 | txiter it = mapTx.find(hash); |
1451 | 1441 | if (it != mapTx.end()) { |
1452 | | - mapTx.modify(it, update_fee_delta(nFeeDelta)); |
| 1442 | + mapTx.modify(it, [&nFeeDelta](CTxMemPoolEntry& e) { e.UpdateModifiedFee(nFeeDelta); }); |
1453 | 1443 | // Now update all ancestors' modified fees with descendants |
1454 | 1444 | setEntries setAncestors; |
1455 | 1445 | uint64_t nNoLimit = std::numeric_limits<uint64_t>::max(); |
|
0 commit comments