Changeset View
Changeset View
Standalone View
Standalone View
src/primitives/transaction.cpp
Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | |||||
double CTransaction::ComputePriority(double dPriorityInputs, | double CTransaction::ComputePriority(double dPriorityInputs, | ||||
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 dPriorityInputs / nTxSize; | ||||
} | } | ||||
int64_t CTransaction::GetNetOutputs() const { | |||||
return vout.size() - vin.size(); | |||||
} | |||||
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 | ||||
// redeem later. | // redeem later. | ||||
if (nTxSize == 0) nTxSize = GetTotalSize(); | if (nTxSize == 0) nTxSize = GetTotalSize(); | ||||
Show All 17 Lines | str += strprintf("CTransaction(txid=%s, ver=%d, vin.size=%u, vout.size=%u, " | ||||
GetId().ToString().substr(0, 10), nVersion, vin.size(), | GetId().ToString().substr(0, 10), nVersion, vin.size(), | ||||
vout.size(), nLockTime); | vout.size(), nLockTime); | ||||
for (unsigned int i = 0; i < vin.size(); i++) | for (unsigned int i = 0; i < vin.size(); i++) | ||||
str += " " + vin[i].ToString() + "\n"; | str += " " + vin[i].ToString() + "\n"; | ||||
for (unsigned int i = 0; i < vout.size(); i++) | for (unsigned int i = 0; i < vout.size(); i++) | ||||
str += " " + vout[i].ToString() + "\n"; | str += " " + vout[i].ToString() + "\n"; | ||||
return str; | return str; | ||||
} | } | ||||
No newline at end of file | No newline at end of file |