diff options
author | Alex Morcos <morcos@chaincode.com> | 2015-11-13 10:05:21 -0500 |
---|---|---|
committer | Alex Morcos <morcos@chaincode.com> | 2015-11-19 21:44:35 -0500 |
commit | c0353064ddf71ad103bd19f6e7c10ff8e240ac46 (patch) | |
tree | 9fec6d8c6ddb79925d90b2d12582e2dee3380de6 /src/txmempool.h | |
parent | 71f1d9fd4ae2c2fc90d5487bdf2096f9eb5898d9 (diff) |
Change GetPriority calculation.
Compute the value of inputs that already are in the chain at time of mempool entry and only increase priority due to aging for those inputs. This effectively changes the CTxMemPoolEntry's GetPriority calculation from an upper bound to a lower bound.
Diffstat (limited to 'src/txmempool.h')
-rw-r--r-- | src/txmempool.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/txmempool.h b/src/txmempool.h index e189e2e463..c470bbe28f 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -66,6 +66,7 @@ private: double entryPriority; //! Priority when entering the mempool unsigned int entryHeight; //! Chain height when entering the mempool bool hadNoDependencies; //! Not dependent on any other txs when it entered the mempool + CAmount inChainInputValue; //! Sum of all txin values that are already in blockchain // Information about descendants of this transaction that are in the // mempool; if we remove this transaction we must remove all of these @@ -78,10 +79,15 @@ private: public: CTxMemPoolEntry(const CTransaction& _tx, const CAmount& _nFee, - int64_t _nTime, double _entryPriority, unsigned int _entryHeight, bool poolHasNoInputsOf); + int64_t _nTime, double _entryPriority, unsigned int _entryHeight, + bool poolHasNoInputsOf, CAmount _inChainInputValue); CTxMemPoolEntry(const CTxMemPoolEntry& other); const CTransaction& GetTx() const { return this->tx; } + /** + * Fast calculation of lower bound of current priority as update + * from entry priority. Only inputs that were originally in-chain will age. + */ double GetPriority(unsigned int currentHeight) const; const CAmount& GetFee() const { return nFee; } size_t GetTxSize() const { return nTxSize; } |