Auto merge of #2141 - bitcartel:1969_free_rate_limiter, r=daira
Closes #1969. Large shielded transactions using the default fee are no longer treated as "free" transactions
This commit is contained in:
commit
14711a4a43
|
@ -51,7 +51,7 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
|||
blocks = []
|
||||
blocks.extend(self.nodes[0].generate(1))
|
||||
|
||||
spends2_raw = [ self.create_tx(txid, node0_address, 9.99) for txid in spends1_id ]
|
||||
spends2_raw = [ self.create_tx(txid, node0_address, 9.999) for txid in spends1_id ]
|
||||
spends2_id = [ self.nodes[0].sendrawtransaction(tx) for tx in spends2_raw ]
|
||||
|
||||
blocks.extend(self.nodes[0].generate(1))
|
||||
|
|
|
@ -127,7 +127,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
|
||||
bal = self.nodes[0].getbalance()
|
||||
inputs = [{ "txid" : txId, "vout" : vout['n'], "scriptPubKey" : vout['scriptPubKey']['hex']}]
|
||||
outputs = { self.nodes[0].getnewaddress() : 2.19 }
|
||||
outputs = { self.nodes[0].getnewaddress() : 2.199 }
|
||||
rawTx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||
rawTxPartialSigned = self.nodes[1].signrawtransaction(rawTx, inputs)
|
||||
assert_equal(rawTxPartialSigned['complete'], False) #node1 only has one key, can't comp. sign the tx
|
||||
|
@ -139,7 +139,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
self.sync_all()
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
assert_equal(self.nodes[0].getbalance(), bal+Decimal('10.00000000')+Decimal('2.19000000')) #block reward + tx
|
||||
assert_equal(self.nodes[0].getbalance(), bal+Decimal('10.00000000')+Decimal('2.19900000')) #block reward + tx
|
||||
|
||||
if __name__ == '__main__':
|
||||
RawTransactionsTest().main()
|
||||
|
|
|
@ -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 = ""
|
||||
|
|
|
@ -24,7 +24,7 @@ class JoinSplitTest(BitcoinTestFramework):
|
|||
|
||||
(total_in, inputs) = gather_inputs(self.nodes[0], 40)
|
||||
protect_tx = self.nodes[0].createrawtransaction(inputs, {})
|
||||
joinsplit_result = self.nodes[0].zcrawjoinsplit(protect_tx, {}, {zcaddress:39.9}, 39.9, 0)
|
||||
joinsplit_result = self.nodes[0].zcrawjoinsplit(protect_tx, {}, {zcaddress:39.99}, 39.99, 0)
|
||||
|
||||
receive_result = self.nodes[0].zcrawreceive(zcsecretkey, joinsplit_result["encryptednote1"])
|
||||
assert_equal(receive_result["exists"], False)
|
||||
|
@ -45,7 +45,7 @@ class JoinSplitTest(BitcoinTestFramework):
|
|||
self.nodes[0].sendtoaddress(addrtest, 0.01);
|
||||
|
||||
joinsplit_tx = self.nodes[0].createrawtransaction([], {})
|
||||
joinsplit_result = self.nodes[0].zcrawjoinsplit(joinsplit_tx, {receive_result["note"] : zcsecretkey}, {zcaddress: 39.8}, 0, 0.1)
|
||||
joinsplit_result = self.nodes[0].zcrawjoinsplit(joinsplit_tx, {receive_result["note"] : zcsecretkey}, {zcaddress: 39.98}, 0, 0.01)
|
||||
|
||||
self.nodes[0].sendrawtransaction(joinsplit_result["rawtxn"])
|
||||
self.nodes[0].generate(1)
|
||||
|
|
|
@ -56,7 +56,7 @@ class JoinSplitTest(BitcoinTestFramework):
|
|||
for i in range(4):
|
||||
(total_in, inputs) = gather_inputs(self.nodes[i], 40)
|
||||
pool[i] = self.nodes[i].createrawtransaction(inputs, {})
|
||||
pool[i] = self.nodes[i].zcrawjoinsplit(pool[i], {}, {zcaddress:39.9}, 39.9, 0)
|
||||
pool[i] = self.nodes[i].zcrawjoinsplit(pool[i], {}, {zcaddress:39.99}, 39.99, 0)
|
||||
signed = self.nodes[i].signrawtransaction(pool[i]["rawtxn"])
|
||||
|
||||
# send the tx to both halves of the network
|
||||
|
@ -90,26 +90,26 @@ class JoinSplitTest(BitcoinTestFramework):
|
|||
# Create joinsplit {A, B}->{*}
|
||||
joinsplit_AB = self.nodes[0].zcrawjoinsplit(blank_tx,
|
||||
{pool[0] : zcsecretkey, pool[1] : zcsecretkey},
|
||||
{zcaddress:(39.9*2)-0.1},
|
||||
0, 0.1)
|
||||
{zcaddress:(39.99*2)-0.01},
|
||||
0, 0.01)
|
||||
|
||||
# Create joinsplit {B, C}->{*}
|
||||
joinsplit_BC = self.nodes[0].zcrawjoinsplit(blank_tx,
|
||||
{pool[1] : zcsecretkey, pool[2] : zcsecretkey},
|
||||
{zcaddress:(39.9*2)-0.1},
|
||||
0, 0.1)
|
||||
{zcaddress:(39.99*2)-0.01},
|
||||
0, 0.01)
|
||||
|
||||
# Create joinsplit {C, D}->{*}
|
||||
joinsplit_CD = self.nodes[0].zcrawjoinsplit(blank_tx,
|
||||
{pool[2] : zcsecretkey, pool[3] : zcsecretkey},
|
||||
{zcaddress:(39.9*2)-0.1},
|
||||
0, 0.1)
|
||||
{zcaddress:(39.99*2)-0.01},
|
||||
0, 0.01)
|
||||
|
||||
# Create joinsplit {A, D}->{*}
|
||||
joinsplit_AD = self.nodes[0].zcrawjoinsplit(blank_tx,
|
||||
{pool[0] : zcsecretkey, pool[3] : zcsecretkey},
|
||||
{zcaddress:(39.9*2)-0.1},
|
||||
0, 0.1)
|
||||
{zcaddress:(39.99*2)-0.01},
|
||||
0, 0.01)
|
||||
|
||||
# (a) Node 0 will spend joinsplit AB, then attempt to
|
||||
# double-spend it with BC. It should fail before and
|
||||
|
|
|
@ -61,7 +61,7 @@ static const unsigned int MAX_P2SH_SIGOPS = 15;
|
|||
/** The maximum number of sigops we're willing to relay/mine in a single tx */
|
||||
static const unsigned int MAX_STANDARD_TX_SIGOPS = MAX_BLOCK_SIGOPS/5;
|
||||
/** Default for -minrelaytxfee, minimum relay fee for transactions */
|
||||
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000;
|
||||
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 100;
|
||||
/** Default for -maxorphantx, maximum number of orphan transactions kept in memory */
|
||||
static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100;
|
||||
/** The maximum size of a blk?????.dat file (since 0.8) */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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…
Reference in New Issue