mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
merge bitcoin#23211: move update_*
structs from txmempool.h to .cpp file
This commit is contained in:
parent
3d769c7a64
commit
ee49383cd6
@ -30,6 +30,58 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
|
// Helpers for modifying CTxMemPool::mapTx, which is a boost multi_index.
|
||||||
|
struct update_descendant_state
|
||||||
|
{
|
||||||
|
update_descendant_state(int64_t _modifySize, CAmount _modifyFee, int64_t _modifyCount) :
|
||||||
|
modifySize(_modifySize), modifyFee(_modifyFee), modifyCount(_modifyCount)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void operator() (CTxMemPoolEntry &e)
|
||||||
|
{ e.UpdateDescendantState(modifySize, modifyFee, modifyCount); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
int64_t modifySize;
|
||||||
|
CAmount modifyFee;
|
||||||
|
int64_t modifyCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct update_ancestor_state
|
||||||
|
{
|
||||||
|
update_ancestor_state(int64_t _modifySize, CAmount _modifyFee, int64_t _modifyCount, int64_t _modifySigOpsCost) :
|
||||||
|
modifySize(_modifySize), modifyFee(_modifyFee), modifyCount(_modifyCount), modifySigOpsCost(_modifySigOpsCost)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void operator() (CTxMemPoolEntry &e)
|
||||||
|
{ e.UpdateAncestorState(modifySize, modifyFee, modifyCount, modifySigOpsCost); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
int64_t modifySize;
|
||||||
|
CAmount modifyFee;
|
||||||
|
int64_t modifyCount;
|
||||||
|
int64_t modifySigOpsCost;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct update_fee_delta
|
||||||
|
{
|
||||||
|
explicit update_fee_delta(int64_t _feeDelta) : feeDelta(_feeDelta) { }
|
||||||
|
|
||||||
|
void operator() (CTxMemPoolEntry &e) { e.UpdateFeeDelta(feeDelta); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
int64_t feeDelta;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct update_lock_points
|
||||||
|
{
|
||||||
|
explicit update_lock_points(const LockPoints& _lp) : lp(_lp) { }
|
||||||
|
|
||||||
|
void operator() (CTxMemPoolEntry &e) { e.UpdateLockPoints(lp); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
const LockPoints& lp;
|
||||||
|
};
|
||||||
|
|
||||||
CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef& tx, CAmount fee,
|
CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef& tx, CAmount fee,
|
||||||
int64_t time, unsigned int entry_height,
|
int64_t time, unsigned int entry_height,
|
||||||
bool spends_coinbase, int64_t sigops_count, LockPoints lp)
|
bool spends_coinbase, int64_t sigops_count, LockPoints lp)
|
||||||
@ -285,7 +337,7 @@ bool CTxMemPool::CalculateMemPoolAncestors(const CTxMemPoolEntry &entry,
|
|||||||
|
|
||||||
void CTxMemPool::UpdateAncestorsOf(bool add, txiter it, setEntries &setAncestors)
|
void CTxMemPool::UpdateAncestorsOf(bool add, txiter it, setEntries &setAncestors)
|
||||||
{
|
{
|
||||||
CTxMemPoolEntry::Parents parents = it->GetMemPoolParents();
|
const CTxMemPoolEntry::Parents& parents = it->GetMemPoolParentsConst();
|
||||||
// add or remove this tx as a child of each parent
|
// add or remove this tx as a child of each parent
|
||||||
for (const CTxMemPoolEntry& parent : parents) {
|
for (const CTxMemPoolEntry& parent : parents) {
|
||||||
UpdateChild(mapTx.iterator_to(parent), it, add);
|
UpdateChild(mapTx.iterator_to(parent), it, add);
|
||||||
|
@ -171,58 +171,6 @@ public:
|
|||||||
mutable Epoch::Marker m_epoch_marker; //!< epoch when last touched, useful for graph algorithms
|
mutable Epoch::Marker m_epoch_marker; //!< epoch when last touched, useful for graph algorithms
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helpers for modifying CTxMemPool::mapTx, which is a boost multi_index.
|
|
||||||
struct update_descendant_state
|
|
||||||
{
|
|
||||||
update_descendant_state(int64_t _modifySize, CAmount _modifyFee, int64_t _modifyCount) :
|
|
||||||
modifySize(_modifySize), modifyFee(_modifyFee), modifyCount(_modifyCount)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void operator() (CTxMemPoolEntry &e)
|
|
||||||
{ e.UpdateDescendantState(modifySize, modifyFee, modifyCount); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
int64_t modifySize;
|
|
||||||
CAmount modifyFee;
|
|
||||||
int64_t modifyCount;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct update_ancestor_state
|
|
||||||
{
|
|
||||||
update_ancestor_state(int64_t _modifySize, CAmount _modifyFee, int64_t _modifyCount, int _modifySigOps) :
|
|
||||||
modifySize(_modifySize), modifyFee(_modifyFee), modifyCount(_modifyCount), modifySigOps(_modifySigOps)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void operator() (CTxMemPoolEntry &e)
|
|
||||||
{ e.UpdateAncestorState(modifySize, modifyFee, modifyCount, modifySigOps); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
int64_t modifySize;
|
|
||||||
CAmount modifyFee;
|
|
||||||
int64_t modifyCount;
|
|
||||||
int modifySigOps;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct update_fee_delta
|
|
||||||
{
|
|
||||||
explicit update_fee_delta(int64_t _feeDelta) : feeDelta(_feeDelta) { }
|
|
||||||
|
|
||||||
void operator() (CTxMemPoolEntry &e) { e.UpdateFeeDelta(feeDelta); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
int64_t feeDelta;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct update_lock_points
|
|
||||||
{
|
|
||||||
explicit update_lock_points(const LockPoints& _lp) : lp(_lp) { }
|
|
||||||
|
|
||||||
void operator() (CTxMemPoolEntry &e) { e.UpdateLockPoints(lp); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
const LockPoints& lp;
|
|
||||||
};
|
|
||||||
|
|
||||||
// extracts a transaction hash from CTxMemPoolEntry or CTransactionRef
|
// extracts a transaction hash from CTxMemPoolEntry or CTransactionRef
|
||||||
struct mempoolentry_txid
|
struct mempoolentry_txid
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user