From c26649f9ed03fa9505e44aaf7f8cfdaa81f734cc Mon Sep 17 00:00:00 2001 From: Alex Morcos Date: Tue, 26 Aug 2014 12:59:21 -0400 Subject: Track modified size in TxMemPoolEntry so that we can correctly compute priority. --- src/txmempool.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/txmempool.cpp') diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 238d5bab16..acdf51c95e 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -23,6 +23,8 @@ CTxMemPoolEntry::CTxMemPoolEntry(const CTransaction& _tx, int64_t _nFee, tx(_tx), nFee(_nFee), nTime(_nTime), dPriority(_dPriority), nHeight(_nHeight) { nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); + + nModSize = tx.CalculateModifiedSize(nTxSize); } CTxMemPoolEntry::CTxMemPoolEntry(const CTxMemPoolEntry& other) @@ -34,7 +36,7 @@ double CTxMemPoolEntry::GetPriority(unsigned int currentHeight) const { int64_t nValueIn = tx.GetValueOut()+nFee; - double deltaPriority = ((double)(currentHeight-nHeight)*nValueIn)/nTxSize; + double deltaPriority = ((double)(currentHeight-nHeight)*nValueIn)/nModSize; double dResult = dPriority + deltaPriority; return dResult; } -- cgit v1.2.3