diff options
| author | Alex Morcos <[email protected]> | 2015-11-13 10:05:21 -0500 |
|---|---|---|
| committer | Alex Morcos <[email protected]> | 2015-11-19 21:44:35 -0500 |
| commit | c0353064ddf71ad103bd19f6e7c10ff8e240ac46 (patch) | |
| tree | 9fec6d8c6ddb79925d90b2d12582e2dee3380de6 /src/coins.cpp | |
| parent | Modify variable names for entry height and priority (diff) | |
| download | discoin-c0353064ddf71ad103bd19f6e7c10ff8e240ac46.tar.xz discoin-c0353064ddf71ad103bd19f6e7c10ff8e240ac46.zip | |
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/coins.cpp')
| -rw-r--r-- | src/coins.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/coins.cpp b/src/coins.cpp index f0ea5c045..723e11470 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -243,8 +243,9 @@ bool CCoinsViewCache::HaveInputs(const CTransaction& tx) const return true; } -double CCoinsViewCache::GetPriority(const CTransaction &tx, int nHeight) const +double CCoinsViewCache::GetPriority(const CTransaction &tx, int nHeight, CAmount &inChainInputValue) const { + inChainInputValue = 0; if (tx.IsCoinBase()) return 0.0; double dResult = 0.0; @@ -253,8 +254,9 @@ double CCoinsViewCache::GetPriority(const CTransaction &tx, int nHeight) const const CCoins* coins = AccessCoins(txin.prevout.hash); assert(coins); if (!coins->IsAvailable(txin.prevout.n)) continue; - if (coins->nHeight < nHeight) { + if (coins->nHeight <= nHeight) { dResult += coins->vout[txin.prevout.n].nValue * (nHeight-coins->nHeight); + inChainInputValue += coins->vout[txin.prevout.n].nValue; } } return tx.ComputePriority(dResult); |