Skip to content

Commit 3e46754

Browse files
MarcoFalkeapoelstra
MarcoFalke
authored andcommitted
Replace struct update_fee_delta with lambda
Cherry-pick of bitcoin/bitcoin#24625 (1/2)
1 parent bd4ae1b commit 3e46754

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/txmempool.cpp

+2-12
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,6 @@ struct update_ancestor_state
6060
int64_t discountSize;
6161
};
6262

63-
struct update_fee_delta
64-
{
65-
explicit update_fee_delta(int64_t _feeDelta) : feeDelta(_feeDelta) { }
66-
67-
void operator() (CTxMemPoolEntry &e) { e.UpdateFeeDelta(feeDelta); }
68-
69-
private:
70-
int64_t feeDelta;
71-
};
72-
7363
bool TestLockPointValidity(CChain& active_chain, const LockPoints& lp)
7464
{
7565
AssertLockHeld(cs_main);
@@ -520,7 +510,7 @@ void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAnces
520510
CAmount delta{0};
521511
ApplyDelta(entry.GetTx().GetHash(), delta);
522512
if (delta) {
523-
mapTx.modify(newit, update_fee_delta(delta));
513+
mapTx.modify(newit, [&delta](CTxMemPoolEntry& e) { e.UpdateFeeDelta(delta); });
524514
}
525515

526516
// Update cachedInnerUsage to include contained transaction's usage.
@@ -1027,7 +1017,7 @@ void CTxMemPool::PrioritiseTransaction(const uint256& hash, const CAmount& nFeeD
10271017
delta += nFeeDelta;
10281018
txiter it = mapTx.find(hash);
10291019
if (it != mapTx.end()) {
1030-
mapTx.modify(it, update_fee_delta(delta));
1020+
mapTx.modify(it, [&delta](CTxMemPoolEntry& e) { e.UpdateFeeDelta(delta); });
10311021
// Now update all ancestors' modified fees with descendants
10321022
setEntries setAncestors;
10331023
uint64_t nNoLimit = std::numeric_limits<uint64_t>::max();

0 commit comments

Comments
 (0)