|
30 | 30 | #include <cmath> |
31 | 31 | #include <optional> |
32 | 32 |
|
| 33 | +// Helpers for modifying CTxMemPool::mapTx, which is a boost multi_index. |
| 34 | +struct update_descendant_state |
| 35 | +{ |
| 36 | + update_descendant_state(int64_t _modifySize, CAmount _modifyFee, int64_t _modifyCount) : |
| 37 | + modifySize(_modifySize), modifyFee(_modifyFee), modifyCount(_modifyCount) |
| 38 | + {} |
| 39 | + |
| 40 | + void operator() (CTxMemPoolEntry &e) |
| 41 | + { e.UpdateDescendantState(modifySize, modifyFee, modifyCount); } |
| 42 | + |
| 43 | + private: |
| 44 | + int64_t modifySize; |
| 45 | + CAmount modifyFee; |
| 46 | + int64_t modifyCount; |
| 47 | +}; |
| 48 | + |
| 49 | +struct update_ancestor_state |
| 50 | +{ |
| 51 | + update_ancestor_state(int64_t _modifySize, CAmount _modifyFee, int64_t _modifyCount, int64_t _modifySigOpsCost) : |
| 52 | + modifySize(_modifySize), modifyFee(_modifyFee), modifyCount(_modifyCount), modifySigOpsCost(_modifySigOpsCost) |
| 53 | + {} |
| 54 | + |
| 55 | + void operator() (CTxMemPoolEntry &e) |
| 56 | + { e.UpdateAncestorState(modifySize, modifyFee, modifyCount, modifySigOpsCost); } |
| 57 | + |
| 58 | + private: |
| 59 | + int64_t modifySize; |
| 60 | + CAmount modifyFee; |
| 61 | + int64_t modifyCount; |
| 62 | + int64_t modifySigOpsCost; |
| 63 | +}; |
| 64 | + |
| 65 | +struct update_fee_delta |
| 66 | +{ |
| 67 | + explicit update_fee_delta(int64_t _feeDelta) : feeDelta(_feeDelta) { } |
| 68 | + |
| 69 | + void operator() (CTxMemPoolEntry &e) { e.UpdateFeeDelta(feeDelta); } |
| 70 | + |
| 71 | +private: |
| 72 | + int64_t feeDelta; |
| 73 | +}; |
| 74 | + |
| 75 | +struct update_lock_points |
| 76 | +{ |
| 77 | + explicit update_lock_points(const LockPoints& _lp) : lp(_lp) { } |
| 78 | + |
| 79 | + void operator() (CTxMemPoolEntry &e) { e.UpdateLockPoints(lp); } |
| 80 | + |
| 81 | +private: |
| 82 | + const LockPoints& lp; |
| 83 | +}; |
| 84 | + |
33 | 85 | CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef& tx, CAmount fee, |
34 | 86 | int64_t time, unsigned int entry_height, |
35 | 87 | bool spends_coinbase, int64_t sigops_count, LockPoints lp) |
@@ -285,7 +337,7 @@ bool CTxMemPool::CalculateMemPoolAncestors(const CTxMemPoolEntry &entry, |
285 | 337 |
|
286 | 338 | void CTxMemPool::UpdateAncestorsOf(bool add, txiter it, setEntries &setAncestors) |
287 | 339 | { |
288 | | - CTxMemPoolEntry::Parents parents = it->GetMemPoolParents(); |
| 340 | + const CTxMemPoolEntry::Parents& parents = it->GetMemPoolParentsConst(); |
289 | 341 | // add or remove this tx as a child of each parent |
290 | 342 | for (const CTxMemPoolEntry& parent : parents) { |
291 | 343 | UpdateChild(mapTx.iterator_to(parent), it, add); |
|
0 commit comments