mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-01 00:34:01 +02:00
Move+rename GetDustIndexes -> GetDust
Use to replace HasDust and where appropraite
This commit is contained in:
@@ -67,6 +67,15 @@ bool IsDust(const CTxOut& txout, const CFeeRate& dustRelayFeeIn)
|
||||
return (txout.nValue < GetDustThreshold(txout, dustRelayFeeIn));
|
||||
}
|
||||
|
||||
std::vector<uint32_t> GetDust(const CTransaction& tx, CFeeRate dust_relay_rate)
|
||||
{
|
||||
std::vector<uint32_t> dust_outputs;
|
||||
for (uint32_t i{0}; i < tx.vout.size(); ++i) {
|
||||
if (IsDust(tx.vout[i], dust_relay_rate)) dust_outputs.push_back(i);
|
||||
}
|
||||
return dust_outputs;
|
||||
}
|
||||
|
||||
bool IsStandard(const CScript& scriptPubKey, const std::optional<unsigned>& max_datacarrier_bytes, TxoutType& whichType)
|
||||
{
|
||||
std::vector<std::vector<unsigned char> > vSolutions;
|
||||
@@ -129,7 +138,6 @@ bool IsStandardTx(const CTransaction& tx, const std::optional<unsigned>& max_dat
|
||||
}
|
||||
|
||||
unsigned int nDataOut = 0;
|
||||
unsigned int num_dust_outputs{0};
|
||||
TxoutType whichType;
|
||||
for (const CTxOut& txout : tx.vout) {
|
||||
if (!::IsStandard(txout.scriptPubKey, max_datacarrier_bytes, whichType)) {
|
||||
@@ -142,13 +150,11 @@ bool IsStandardTx(const CTransaction& tx, const std::optional<unsigned>& max_dat
|
||||
else if ((whichType == TxoutType::MULTISIG) && (!permit_bare_multisig)) {
|
||||
reason = "bare-multisig";
|
||||
return false;
|
||||
} else if (IsDust(txout, dust_relay_fee)) {
|
||||
num_dust_outputs++;
|
||||
}
|
||||
}
|
||||
|
||||
// Only MAX_DUST_OUTPUTS_PER_TX dust is permitted(on otherwise valid ephemeral dust)
|
||||
if (num_dust_outputs > MAX_DUST_OUTPUTS_PER_TX) {
|
||||
if (GetDust(tx, dust_relay_fee).size() > MAX_DUST_OUTPUTS_PER_TX) {
|
||||
reason = "dust";
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user