|
21 | 21 | #include <cmath> |
22 | 22 | #include <optional> |
23 | 23 |
|
| 24 | +// Helpers for modifying CTxMemPool::mapTx, which is a boost multi_index. |
| 25 | +struct update_descendant_state |
| 26 | +{ |
| 27 | + update_descendant_state(int64_t _modifySize, CAmount _modifyFee, int64_t _modifyCount) : |
| 28 | + modifySize(_modifySize), modifyFee(_modifyFee), modifyCount(_modifyCount) |
| 29 | + {} |
| 30 | + |
| 31 | + void operator() (CTxMemPoolEntry &e) |
| 32 | + { e.UpdateDescendantState(modifySize, modifyFee, modifyCount); } |
| 33 | + |
| 34 | + private: |
| 35 | + int64_t modifySize; |
| 36 | + CAmount modifyFee; |
| 37 | + int64_t modifyCount; |
| 38 | +}; |
| 39 | + |
| 40 | +struct update_ancestor_state |
| 41 | +{ |
| 42 | + update_ancestor_state(int64_t _modifySize, CAmount _modifyFee, int64_t _modifyCount, int64_t _modifySigOpsCost) : |
| 43 | + modifySize(_modifySize), modifyFee(_modifyFee), modifyCount(_modifyCount), modifySigOpsCost(_modifySigOpsCost) |
| 44 | + {} |
| 45 | + |
| 46 | + void operator() (CTxMemPoolEntry &e) |
| 47 | + { e.UpdateAncestorState(modifySize, modifyFee, modifyCount, modifySigOpsCost); } |
| 48 | + |
| 49 | + private: |
| 50 | + int64_t modifySize; |
| 51 | + CAmount modifyFee; |
| 52 | + int64_t modifyCount; |
| 53 | + int64_t modifySigOpsCost; |
| 54 | +}; |
| 55 | + |
| 56 | +struct update_fee_delta |
| 57 | +{ |
| 58 | + explicit update_fee_delta(int64_t _feeDelta) : feeDelta(_feeDelta) { } |
| 59 | + |
| 60 | + void operator() (CTxMemPoolEntry &e) { e.UpdateFeeDelta(feeDelta); } |
| 61 | + |
| 62 | +private: |
| 63 | + int64_t feeDelta; |
| 64 | +}; |
| 65 | + |
| 66 | +struct update_lock_points |
| 67 | +{ |
| 68 | + explicit update_lock_points(const LockPoints& _lp) : lp(_lp) { } |
| 69 | + |
| 70 | + void operator() (CTxMemPoolEntry &e) { e.UpdateLockPoints(lp); } |
| 71 | + |
| 72 | +private: |
| 73 | + const LockPoints& lp; |
| 74 | +}; |
| 75 | + |
24 | 76 | CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef& tx, CAmount fee, |
25 | 77 | int64_t time, unsigned int entry_height, |
26 | 78 | bool spends_coinbase, int64_t sigops_cost, LockPoints lp) |
|
0 commit comments