aboutsummaryrefslogtreecommitdiff
path: root/src/core.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2013-11-11 17:35:14 +1000
committerGavin Andresen <gavinandresen@gmail.com>2013-11-30 15:42:10 +1000
commit4d707d512070ed88c888fdf625c0ae0f85f68d9b (patch)
tree2fe293e6b06acff639d8c1361fe1c0725313dd30 /src/core.cpp
parent0733c1bde69c6ccfe593d2eec775d0ae32fe7140 (diff)
downloadbitcoin-4d707d512070ed88c888fdf625c0ae0f85f68d9b.tar.xz
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/core.cpp')
-rw-r--r--src/core.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core.cpp b/src/core.cpp
index 5da6f11b51..f41ea87fea 100644
--- a/src/core.cpp
+++ b/src/core.cpp
@@ -118,6 +118,25 @@ int64_t CTransaction::GetValueOut() const
return nValueOut;
}
+double CTransaction::ComputePriority(double dPriorityInputs, unsigned int nTxSize) const
+{
+ // In order to avoid disincentivizing cleaning up the UTXO set we don't count
+ // the constant overhead for each txin and up to 110 bytes of scriptSig (which
+ // is enough to cover a compressed pubkey p2sh redemption) for priority.
+ // Providing any more cleanup incentive than making additional inputs free would
+ // risk encouraging people to create junk outputs to redeem later.
+ if (nTxSize == 0)
+ nTxSize = ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION);
+ BOOST_FOREACH(const CTxIn& txin, vin)
+ {
+ unsigned int offset = 41U + std::min(110U, (unsigned int)txin.scriptSig.size());
+ if (nTxSize > offset)
+ nTxSize -= offset;
+ }
+ if (nTxSize == 0) return 0.0;
+ return dPriorityInputs / nTxSize;
+}
+
std::string CTransaction::ToString() const
{
std::string str;