diff options
Diffstat (limited to 'src/txmempool.h')
-rw-r--r-- | src/txmempool.h | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src/txmempool.h b/src/txmempool.h index 2c2127f326..9b0ca4655e 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -6,15 +6,19 @@ #ifndef BITCOIN_TXMEMPOOL_H #define BITCOIN_TXMEMPOOL_H -#include <list> #include <memory> #include <set> +#include <map> +#include <vector> +#include <utility> +#include <string> #include "amount.h" #include "coins.h" #include "indirectmap.h" #include "primitives/transaction.h" #include "sync.h" +#include "random.h" #undef foreach #include "boost/multi_index_container.hpp" @@ -325,17 +329,23 @@ struct TxMempoolInfo /** Feerate of the transaction. */ CFeeRate feeRate; + + /** The fee delta. */ + int64_t nFeeDelta; }; /** - * CTxMemPool stores valid-according-to-the-current-best-chain - * transactions that may be included in the next block. + * CTxMemPool stores valid-according-to-the-current-best-chain transactions + * that may be included in the next block. * - * 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: if a new transaction double-spends - * an input of a transaction in the pool, it is dropped, - * as are non-standard transactions. + * 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 + * example, the following new transactions will not be added to the mempool: + * - a transaction which doesn't make the mimimum fee requirements. + * - a new transaction that double-spends an input of a transaction already in + * the pool where the new transaction does not meet the Replace-By-Fee + * requirements as defined in BIP 125. + * - a non-standard transaction. * * CTxMemPool::mapTx, and CTxMemPoolEntry bookkeeping: * @@ -462,7 +472,7 @@ public: indexed_transaction_set mapTx; typedef indexed_transaction_set::nth_index<0>::type::iterator txiter; - std::vector<std::pair<uint256, txiter> > vTxHashes; //!< All tx hashes/entries in mapTx, in random order + std::vector<std::pair<uint256, txiter> > vTxHashes; //!< All tx witness hashes/entries in mapTx, in random order struct CompareIteratorByHash { bool operator()(const txiter &a, const txiter &b) const { @@ -517,11 +527,11 @@ public: bool addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry, bool fCurrentEstimate = true); bool addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry, setEntries &setAncestors, bool fCurrentEstimate = true); - void removeRecursive(const CTransaction &tx, std::list<CTransaction>& removed); + void removeRecursive(const CTransaction &tx, std::vector<std::shared_ptr<const CTransaction>>* removed = NULL); void removeForReorg(const CCoinsViewCache *pcoins, unsigned int nMemPoolHeight, int flags); - void removeConflicts(const CTransaction &tx, std::list<CTransaction>& removed); + void removeConflicts(const CTransaction &tx, std::vector<std::shared_ptr<const CTransaction>>* removed = NULL); void removeForBlock(const std::vector<CTransaction>& vtx, unsigned int nBlockHeight, - std::list<CTransaction>& conflicts, bool fCurrentEstimate = true); + std::vector<std::shared_ptr<const CTransaction>>* conflicts = NULL, bool fCurrentEstimate = true); void clear(); void _clear(); //lock free bool CompareDepthAndScore(const uint256& hasha, const uint256& hashb); |