Browse Source

Part of #1969. Changing min fee calculation also changes the dust threshold.

pull/4/head
Simon 7 years ago
parent
commit
ebe750a882
  1. 2
      qa/rpc-tests/wallet_protectcoinbase.py
  2. 2
      src/primitives/transaction.h
  3. 4
      src/test/transaction_tests.cpp

2
qa/rpc-tests/wallet_protectcoinbase.py

@ -181,7 +181,7 @@ class WalletProtectCoinbaseTest (BitcoinTestFramework):
amount = Decimal('10.0') - Decimal('0.00010000') - Decimal('0.00000001') # this leaves change at 1 zatoshi less than dust threshold
recipients.append({"address":self.nodes[0].getnewaddress(), "amount":amount })
myopid = self.nodes[0].z_sendmany(mytaddr, recipients)
self.wait_and_assert_operationid_status(myopid, "failed", "Insufficient transparent funds, have 10.00, need 0.00000545 more to avoid creating invalid change output 0.00000001 (dust threshold is 0.00000546)")
self.wait_and_assert_operationid_status(myopid, "failed", "Insufficient transparent funds, have 10.00, need 0.00000053 more to avoid creating invalid change output 0.00000001 (dust threshold is 0.00000054)")
# Send will fail because send amount is too big, even when including coinbase utxos
errorString = ""

2
src/primitives/transaction.h

@ -274,7 +274,7 @@ public:
// to spend something, then we consider it dust.
// A typical txout is 34 bytes big, and will
// need a CTxIn of at least 148 bytes to spend:
// so dust is a txout less than 546 satoshis
// so dust is a txout less than 54 satoshis
// with default minRelayTxFee.
size_t nSize = GetSerializeSize(SER_DISK,0)+148u;
return 3*minRelayTxFee.GetFee(nSize);

4
src/test/transaction_tests.cpp

@ -560,7 +560,7 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
string reason;
BOOST_CHECK(IsStandardTx(t, reason));
t.vout[0].nValue = 501; // dust
t.vout[0].nValue = 53; // dust
BOOST_CHECK(!IsStandardTx(t, reason));
t.vout[0].nValue = 2730; // not dust
@ -639,7 +639,7 @@ BOOST_AUTO_TEST_CASE(test_IsStandardV2)
BOOST_CHECK(IsStandardTx(t, reason));
// v2 transactions can still be non-standard for the same reasons as v1.
t.vout[0].nValue = 501; // dust
t.vout[0].nValue = 53; // dust
BOOST_CHECK(!IsStandardTx(t, reason));
// v3 is not standard.

Loading…
Cancel
Save