Merge pull request #34 from kaykurokawa/check_dust
Re-enable dust threshold checks
This commit is contained in:
commit
b89ff5f456
2 changed files with 16 additions and 9 deletions
|
@ -171,14 +171,18 @@ public:
|
||||||
if (scriptPubKey.IsUnspendable())
|
if (scriptPubKey.IsUnspendable())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
size_t nSize = GetSerializeSize(SER_DISK,0)+148u;
|
// for lbrycrd this is mainly to prevent 0 value claims
|
||||||
return 3*minRelayTxFee.GetFee(nSize);
|
// and some spam protection without limiting small
|
||||||
|
// lbrynet transactions
|
||||||
|
return 1;
|
||||||
|
// below is original bitcoin core code
|
||||||
|
//size_t nSize = GetSerializeSize(SER_DISK,0)+dd148u;
|
||||||
|
//return 3*minRelayTxFee.GetFee(nSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsDust(const CFeeRate &minRelayTxFee) const
|
bool IsDust(const CFeeRate &minRelayTxFee) const
|
||||||
{
|
{
|
||||||
return false;
|
return (nValue < GetDustThreshold(minRelayTxFee));
|
||||||
// return (nValue < GetDustThreshold(minRelayTxFee));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator==(const CTxOut& a, const CTxOut& b)
|
friend bool operator==(const CTxOut& a, const CTxOut& b)
|
||||||
|
|
|
@ -337,11 +337,14 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
|
||||||
BOOST_CHECK(IsStandardTx(t, reason));
|
BOOST_CHECK(IsStandardTx(t, reason));
|
||||||
|
|
||||||
// Check dust with default relay fee:
|
// Check dust with default relay fee:
|
||||||
CAmount nDustThreshold = 182 * minRelayTxFee.GetFeePerK()/1000 * 3;
|
//CAmount nDustThreshold = 182 * minRelayTxFee.GetFeePerK()/1000 * 3;
|
||||||
BOOST_CHECK_EQUAL(nDustThreshold, 546);
|
//BOOST_CHECK_EQUAL(nDustThreshold, 546);
|
||||||
|
// lbry dust is set to 1, regardless of minRelayTxfee
|
||||||
|
CAmount nDustThreshold = 1;
|
||||||
|
|
||||||
// dust:
|
// dust:
|
||||||
//t.vout[0].nValue = nDustThreshold - 1;
|
t.vout[0].nValue = nDustThreshold - 1;
|
||||||
//BOOST_CHECK(!IsStandardTx(t, reason));
|
BOOST_CHECK(!IsStandardTx(t, reason));
|
||||||
// not dust:
|
// not dust:
|
||||||
t.vout[0].nValue = nDustThreshold;
|
t.vout[0].nValue = nDustThreshold;
|
||||||
BOOST_CHECK(IsStandardTx(t, reason));
|
BOOST_CHECK(IsStandardTx(t, reason));
|
||||||
|
|
Loading…
Reference in a new issue