|
|
|
@ -123,6 +123,14 @@ int64_t CTransaction::GetValueOut() const
@@ -123,6 +123,14 @@ int64_t CTransaction::GetValueOut() const
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
double CTransaction::ComputePriority(double dPriorityInputs, unsigned int nTxSize) const |
|
|
|
|
{ |
|
|
|
|
nTxSize = CalculateModifiedSize(nTxSize); |
|
|
|
|
if (nTxSize == 0) return 0.0; |
|
|
|
|
|
|
|
|
|
return dPriorityInputs / nTxSize; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
unsigned int CTransaction::CalculateModifiedSize(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
|
|
|
|
@ -131,14 +139,14 @@ double CTransaction::ComputePriority(double dPriorityInputs, unsigned int nTxSiz
@@ -131,14 +139,14 @@ double CTransaction::ComputePriority(double dPriorityInputs, unsigned int nTxSiz
|
|
|
|
|
// 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; |
|
|
|
|
return nTxSize; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::string CTransaction::ToString() const |
|
|
|
|