diff options
author | Alex Morcos <morcos@chaincode.com> | 2014-08-26 12:59:21 -0400 |
---|---|---|
committer | Alex Morcos <morcos@chaincode.com> | 2014-09-08 11:28:46 -0400 |
commit | c26649f9ed03fa9505e44aaf7f8cfdaa81f734cc (patch) | |
tree | 96c35a3632b724ad67ee4d43d0be0ea0df04a8db /src/txmempool.cpp | |
parent | b8d92236f61699846f67d8ce6cb55458a46f9de1 (diff) |
Track modified size in TxMemPoolEntry so that we can correctly compute priority.
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r-- | src/txmempool.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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; } |