Skip to content

Commit

Permalink
Replace struct update_lock_points with lambda
Browse files Browse the repository at this point in the history
Summary:
No behavior change.
This code was introduced in 5add7a7 before we required C++11, which is
why the struct was needed. As we are now using more modern C++ and this
is the only place where lockpoints are updated for mempool entries, it
is more idiomatic to call `modify` with a lambda.

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>

This concludes backport of [[bitcoin/bitcoin#23976 | core#23976]]
bitcoin/bitcoin@e177fca

Depends on D12587

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12588
  • Loading branch information
glozow authored and PiRK committed Nov 24, 2022
1 parent 597f5af commit 5cf1f28
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,8 @@ void DisconnectedBlockTransactions::updateMempoolForReorg(
if (!validLP) {
// If CheckSequenceLocks succeeded, it also updated the
// LockPoints. Now update the mempool entry lockpoints as well.
pool.mapTx.modify(it, update_lock_points(lp));
pool.mapTx.modify(
it, [&lp](CTxMemPoolEntry &e) { e.UpdateLockPoints(lp); });
}

// If the transaction spends any coinbase outputs, it must be
Expand Down
9 changes: 0 additions & 9 deletions src/txmempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,6 @@ class CompareTxMemPoolEntryByAncestorFee {
}
};

struct update_lock_points {
explicit update_lock_points(const LockPoints &_lp) : lp(_lp) {}

void operator()(CTxMemPoolEntry &e) { e.UpdateLockPoints(lp); }

private:
const LockPoints &lp;
};

// Multi_index tag names
struct descendant_score {};
struct entry_time {};
Expand Down

0 comments on commit 5cf1f28

Please sign in to comment.