Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.h
Show First 20 Lines • Show All 375 Lines • ▼ Show 20 Lines | |||||
public: | public: | ||||
SaltedTxidHasher(); | SaltedTxidHasher(); | ||||
size_t operator()(const TxId &txid) const { | size_t operator()(const TxId &txid) const { | ||||
return SipHashUint256(k0, k1, txid); | return SipHashUint256(k0, k1, txid); | ||||
} | } | ||||
}; | }; | ||||
typedef std::pair<double, Amount> TXModifier; | |||||
/** | /** | ||||
* CTxMemPool stores valid-according-to-the-current-best-chain transactions that | * CTxMemPool stores valid-according-to-the-current-best-chain transactions that | ||||
* may be included in the next block. | * may be included in the next block. | ||||
* | * | ||||
* Transactions are added when they are seen on the network (or created by the | * Transactions are added when they are seen on the network (or created by the | ||||
* local node), but not all transactions seen are added to the pool. For | * local node), but not all transactions seen are added to the pool. For | ||||
* example, the following new transactions will not be added to the mempool: | * example, the following new transactions will not be added to the mempool: | ||||
* - a transaction which doesn't meet the minimum fee requirements. | * - a transaction which doesn't meet the minimum fee requirements. | ||||
▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | private: | ||||
void UpdateParent(txiter entry, txiter parent, bool add); | void UpdateParent(txiter entry, txiter parent, bool add); | ||||
void UpdateChild(txiter entry, txiter child, bool add); | void UpdateChild(txiter entry, txiter child, bool add); | ||||
std::vector<indexed_transaction_set::const_iterator> | std::vector<indexed_transaction_set::const_iterator> | ||||
GetSortedDepthAndScore() const EXCLUSIVE_LOCKS_REQUIRED(cs); | GetSortedDepthAndScore() const EXCLUSIVE_LOCKS_REQUIRED(cs); | ||||
public: | public: | ||||
indirectmap<COutPoint, const CTransaction *> mapNextTx GUARDED_BY(cs); | indirectmap<COutPoint, const CTransaction *> mapNextTx GUARDED_BY(cs); | ||||
std::map<TxId, TXModifier> mapDeltas; | std::map<TxId, Amount> mapDeltas; | ||||
/** | /** | ||||
* Create a new CTxMemPool. | * Create a new CTxMemPool. | ||||
*/ | */ | ||||
CTxMemPool(); | CTxMemPool(); | ||||
~CTxMemPool(); | ~CTxMemPool(); | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | public: | ||||
/** | /** | ||||
* Check that none of this transactions inputs are in the mempool, and thus | * Check that none of this transactions inputs are in the mempool, and thus | ||||
* the tx is not dependent on other mempool transactions to be included in a | * the tx is not dependent on other mempool transactions to be included in a | ||||
* block. | * block. | ||||
*/ | */ | ||||
bool HasNoInputsOf(const CTransaction &tx) const; | bool HasNoInputsOf(const CTransaction &tx) const; | ||||
/** Affect CreateNewBlock prioritisation of transactions */ | /** Affect CreateNewBlock prioritisation of transactions */ | ||||
void PrioritiseTransaction(const TxId &txid, double dPriorityDelta, | void PrioritiseTransaction(const TxId &txid, const Amount nFeeDelta); | ||||
const Amount nFeeDelta); | void ApplyDelta(const TxId &txid, Amount &nFeeDelta) const; | ||||
void ApplyDeltas(const TxId &txid, double &dPriorityDelta, | |||||
Amount &nFeeDelta) const; | |||||
void ClearPrioritisation(const TxId &txid); | void ClearPrioritisation(const TxId &txid); | ||||
/** Get the transaction in the pool that spends the same prevout */ | /** Get the transaction in the pool that spends the same prevout */ | ||||
const CTransaction *GetConflictTx(const COutPoint &prevout) const | const CTransaction *GetConflictTx(const COutPoint &prevout) const | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs); | EXCLUSIVE_LOCKS_REQUIRED(cs); | ||||
/** Returns an iterator to the given txid, if found */ | /** Returns an iterator to the given txid, if found */ | ||||
boost::optional<txiter> GetIter(const TxId &txid) const | boost::optional<txiter> GetIter(const TxId &txid) const | ||||
▲ Show 20 Lines • Show All 324 Lines • Show Last 20 Lines |