diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2013-11-11 17:35:14 +1000 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2013-11-30 15:42:10 +1000 |
commit | 4d707d512070ed88c888fdf625c0ae0f85f68d9b (patch) | |
tree | 2fe293e6b06acff639d8c1361fe1c0725313dd30 /src/coins.cpp | |
parent | 0733c1bde69c6ccfe593d2eec775d0ae32fe7140 (diff) |
Add verbose boolean to getrawmempool
Also changes mempool to store CTxMemPoolEntries
to keep track of when they enter/exit the pool.
Diffstat (limited to 'src/coins.cpp')
-rw-r--r-- | src/coins.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/coins.cpp b/src/coins.cpp index ed82c9df8b..86b2a6ef17 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -178,3 +178,19 @@ bool CCoinsViewCache::HaveInputs(const CTransaction& tx) } return true; } + +double CCoinsViewCache::GetPriority(const CTransaction &tx, int nHeight) +{ + if (tx.IsCoinBase()) + return 0.0; + double dResult = 0.0; + BOOST_FOREACH(const CTxIn& txin, tx.vin) + { + const CCoins &coins = GetCoins(txin.prevout.hash); + if (!coins.IsAvailable(txin.prevout.n)) continue; + if (coins.nHeight < nHeight) { + dResult += coins.vout[txin.prevout.n].nValue * (nHeight-coins.nHeight); + } + } + return tx.ComputePriority(dResult); +} |