Changeset View
Changeset View
Standalone View
Standalone View
src/primitives/transaction.cpp
Show First 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | for (std::vector<CTxOut>::const_iterator it(vout.begin()); it != vout.end(); | ||||
nValueOut += it->nValue; | nValueOut += it->nValue; | ||||
if (!MoneyRange(it->nValue) || !MoneyRange(nValueOut)) | if (!MoneyRange(it->nValue) || !MoneyRange(nValueOut)) | ||||
throw std::runtime_error(std::string(__func__) + | throw std::runtime_error(std::string(__func__) + | ||||
": value out of range"); | ": value out of range"); | ||||
} | } | ||||
return nValueOut; | return nValueOut; | ||||
} | } | ||||
double CTransaction::ComputePriority(double dPriorityInputs, | double CTransaction::ComputePriority(double coinBlocksDestroyed, | ||||
unsigned int nTxSize) const { | unsigned int nTxSize) const { | ||||
nTxSize = CalculateModifiedSize(nTxSize); | nTxSize = CalculateModifiedSize(nTxSize); | ||||
if (nTxSize == 0) return 0.0; | if (nTxSize == 0) return 0.0; | ||||
return dPriorityInputs / nTxSize; | return coinBlocksDestroyed / nTxSize; | ||||
} | } | ||||
unsigned int CTransaction::CalculateModifiedSize(unsigned int nTxSize) const { | unsigned int CTransaction::CalculateModifiedSize(unsigned int nTxSize) const { | ||||
// In order to avoid disincentivizing cleaning up the UTXO set we don't | // 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 | // count the constant overhead for each txin and up to 110 bytes of | ||||
// scriptSig (which is enough to cover a compressed pubkey p2sh redemption) | // scriptSig (which is enough to cover a compressed pubkey p2sh redemption) | ||||
// for priority. Providing any more cleanup incentive than making additional | // for priority. Providing any more cleanup incentive than making additional | ||||
// inputs free would risk encouraging people to create junk outputs to | // inputs free would risk encouraging people to create junk outputs to | ||||
Show All 31 Lines |