Changeset View
Changeset View
Standalone View
Standalone View
src/policy/policy.cpp
Show All 20 Lines | Amount GetDustThreshold(const CTxOut &txout, const CFeeRate &dustRelayFeeIn) { | ||||
* something, then we consider it dust. A typical spendable txout is 34 | * something, then we consider it dust. A typical spendable txout is 34 | ||||
* bytes big, and will need a CTxIn of at least 148 bytes to spend: so dust | * bytes big, and will need a CTxIn of at least 148 bytes to spend: so dust | ||||
* is a spendable txout less than 546*dustRelayFee/1000 (in satoshis). | * is a spendable txout less than 546*dustRelayFee/1000 (in satoshis). | ||||
*/ | */ | ||||
if (txout.scriptPubKey.IsUnspendable()) { | if (txout.scriptPubKey.IsUnspendable()) { | ||||
return Amount::zero(); | return Amount::zero(); | ||||
} | } | ||||
size_t nSize = GetSerializeSize(txout, SER_DISK, 0); | size_t nSize = GetSerializeSize(txout); | ||||
// the 148 mentioned above | // the 148 mentioned above | ||||
nSize += (32 + 4 + 1 + 107 + 4); | nSize += (32 + 4 + 1 + 107 + 4); | ||||
return 3 * dustRelayFeeIn.GetFee(nSize); | return 3 * dustRelayFeeIn.GetFee(nSize); | ||||
} | } | ||||
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFeeIn) { | bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFeeIn) { | ||||
▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | |||||
int64_t GetVirtualTransactionSize(int64_t nSize, int64_t nSigOpCost, | int64_t GetVirtualTransactionSize(int64_t nSize, int64_t nSigOpCost, | ||||
unsigned int bytes_per_sigop) { | unsigned int bytes_per_sigop) { | ||||
return nSize; | return nSize; | ||||
} | } | ||||
int64_t GetVirtualTransactionSize(const CTransaction &tx, int64_t nSigOpCost, | int64_t GetVirtualTransactionSize(const CTransaction &tx, int64_t nSigOpCost, | ||||
unsigned int bytes_per_sigop) { | unsigned int bytes_per_sigop) { | ||||
return GetVirtualTransactionSize( | return GetVirtualTransactionSize(::GetSerializeSize(tx, PROTOCOL_VERSION), | ||||
::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION), nSigOpCost, | nSigOpCost, bytes_per_sigop); | ||||
bytes_per_sigop); | |||||
} | } | ||||
int64_t GetVirtualTransactionInputSize(const CTxIn &txin, int64_t nSigOpCost, | int64_t GetVirtualTransactionInputSize(const CTxIn &txin, int64_t nSigOpCost, | ||||
unsigned int bytes_per_sigop) { | unsigned int bytes_per_sigop) { | ||||
return GetVirtualTransactionSize( | return GetVirtualTransactionSize(::GetSerializeSize(txin, PROTOCOL_VERSION), | ||||
::GetSerializeSize(txin, SER_NETWORK, PROTOCOL_VERSION), nSigOpCost, | nSigOpCost, bytes_per_sigop); | ||||
bytes_per_sigop); | |||||
} | } |