Browse Source

Merge #7177: [qa] Change default block priority size to 0

fa8e2a6 [qa] Change default block priority size to 0 (MarcoFalke)
0.13
Wladimir J. van der Laan 9 years ago
parent
commit
93b05764d5
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 2
      qa/rpc-tests/invalidtxrequest.py
  2. 12
      qa/rpc-tests/mempool_reorg.py
  3. 4
      qa/rpc-tests/mempool_resurrect_test.py
  4. 2
      qa/rpc-tests/mempool_spendcoinbase.py
  5. 6
      qa/rpc-tests/merkle_blocks.py
  6. 3
      qa/rpc-tests/test_framework/util.py
  7. 9
      qa/rpc-tests/wallet.py

2
qa/rpc-tests/invalidtxrequest.py

@ -63,7 +63,7 @@ class InvalidTxRequestTest(ComparisonTestFramework):
# chr(100) is OP_NOTIF # chr(100) is OP_NOTIF
# Transaction will be rejected with code 16 (REJECT_INVALID) # Transaction will be rejected with code 16 (REJECT_INVALID)
tx1 = create_transaction(self.block1.vtx[0], 0, chr(100), 50*100000000) tx1 = create_transaction(self.block1.vtx[0], 0, chr(100), 50*100000000 - 12000)
yield TestInstance([[tx1, RejectResult(16, 'mandatory-script-verify-flag-failed')]]) yield TestInstance([[tx1, RejectResult(16, 'mandatory-script-verify-flag-failed')]])
# TODO: test further transactions... # TODO: test further transactions...

12
qa/rpc-tests/mempool_reorg.py

@ -52,12 +52,12 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
# and make sure the mempool code behaves correctly. # and make sure the mempool code behaves correctly.
b = [ self.nodes[0].getblockhash(n) for n in range(101, 105) ] b = [ self.nodes[0].getblockhash(n) for n in range(101, 105) ]
coinbase_txids = [ self.nodes[0].getblock(h)['tx'][0] for h in b ] coinbase_txids = [ self.nodes[0].getblock(h)['tx'][0] for h in b ]
spend_101_raw = self.create_tx(coinbase_txids[1], node1_address, 50) spend_101_raw = self.create_tx(coinbase_txids[1], node1_address, 49.99)
spend_102_raw = self.create_tx(coinbase_txids[2], node0_address, 50) spend_102_raw = self.create_tx(coinbase_txids[2], node0_address, 49.99)
spend_103_raw = self.create_tx(coinbase_txids[3], node0_address, 50) spend_103_raw = self.create_tx(coinbase_txids[3], node0_address, 49.99)
# Create a block-height-locked transaction which will be invalid after reorg # Create a block-height-locked transaction which will be invalid after reorg
timelock_tx = self.nodes[0].createrawtransaction([{"txid": coinbase_txids[0], "vout": 0}], {node0_address: 50}) timelock_tx = self.nodes[0].createrawtransaction([{"txid": coinbase_txids[0], "vout": 0}], {node0_address: 49.99})
# Set the time lock # Set the time lock
timelock_tx = timelock_tx.replace("ffffffff", "11111111", 1) timelock_tx = timelock_tx.replace("ffffffff", "11111111", 1)
timelock_tx = timelock_tx[:-8] + hex(self.nodes[0].getblockcount() + 2)[2:] + "000000" timelock_tx = timelock_tx[:-8] + hex(self.nodes[0].getblockcount() + 2)[2:] + "000000"
@ -71,8 +71,8 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
assert_raises(JSONRPCException, self.nodes[0].sendrawtransaction, timelock_tx) assert_raises(JSONRPCException, self.nodes[0].sendrawtransaction, timelock_tx)
# Create 102_1 and 103_1: # Create 102_1 and 103_1:
spend_102_1_raw = self.create_tx(spend_102_id, node1_address, 50) spend_102_1_raw = self.create_tx(spend_102_id, node1_address, 49.98)
spend_103_1_raw = self.create_tx(spend_103_id, node1_address, 50) spend_103_1_raw = self.create_tx(spend_103_id, node1_address, 49.98)
# Broadcast and mine 103_1: # Broadcast and mine 103_1:
spend_103_1_id = self.nodes[0].sendrawtransaction(spend_103_1_raw) spend_103_1_id = self.nodes[0].sendrawtransaction(spend_103_1_raw)

4
qa/rpc-tests/mempool_resurrect_test.py

@ -43,13 +43,13 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
b = [ self.nodes[0].getblockhash(n) for n in range(1, 4) ] b = [ self.nodes[0].getblockhash(n) for n in range(1, 4) ]
coinbase_txids = [ self.nodes[0].getblock(h)['tx'][0] for h in b ] coinbase_txids = [ self.nodes[0].getblock(h)['tx'][0] for h in b ]
spends1_raw = [ self.create_tx(txid, node0_address, 50) for txid in coinbase_txids ] spends1_raw = [ self.create_tx(txid, node0_address, 49.99) for txid in coinbase_txids ]
spends1_id = [ self.nodes[0].sendrawtransaction(tx) for tx in spends1_raw ] spends1_id = [ self.nodes[0].sendrawtransaction(tx) for tx in spends1_raw ]
blocks = [] blocks = []
blocks.extend(self.nodes[0].generate(1)) blocks.extend(self.nodes[0].generate(1))
spends2_raw = [ self.create_tx(txid, node0_address, 49.99) for txid in spends1_id ] spends2_raw = [ self.create_tx(txid, node0_address, 49.98) for txid in spends1_id ]
spends2_id = [ self.nodes[0].sendrawtransaction(tx) for tx in spends2_raw ] spends2_id = [ self.nodes[0].sendrawtransaction(tx) for tx in spends2_raw ]
blocks.extend(self.nodes[0].generate(1)) blocks.extend(self.nodes[0].generate(1))

2
qa/rpc-tests/mempool_spendcoinbase.py

@ -44,7 +44,7 @@ class MempoolSpendCoinbaseTest(BitcoinTestFramework):
# is too immature to spend. # is too immature to spend.
b = [ self.nodes[0].getblockhash(n) for n in range(101, 103) ] b = [ self.nodes[0].getblockhash(n) for n in range(101, 103) ]
coinbase_txids = [ self.nodes[0].getblock(h)['tx'][0] for h in b ] coinbase_txids = [ self.nodes[0].getblock(h)['tx'][0] for h in b ]
spends_raw = [ self.create_tx(txid, node0_address, 50) for txid in coinbase_txids ] spends_raw = [ self.create_tx(txid, node0_address, 49.99) for txid in coinbase_txids ]
spend_101_id = self.nodes[0].sendrawtransaction(spends_raw[0]) spend_101_id = self.nodes[0].sendrawtransaction(spends_raw[0])

6
qa/rpc-tests/merkle_blocks.py

@ -42,9 +42,9 @@ class MerkleBlockTest(BitcoinTestFramework):
assert_equal(self.nodes[2].getbalance(), 0) assert_equal(self.nodes[2].getbalance(), 0)
node0utxos = self.nodes[0].listunspent(1) node0utxos = self.nodes[0].listunspent(1)
tx1 = self.nodes[0].createrawtransaction([node0utxos.pop()], {self.nodes[1].getnewaddress(): 50}) tx1 = self.nodes[0].createrawtransaction([node0utxos.pop()], {self.nodes[1].getnewaddress(): 49.99})
txid1 = self.nodes[0].sendrawtransaction(self.nodes[0].signrawtransaction(tx1)["hex"]) txid1 = self.nodes[0].sendrawtransaction(self.nodes[0].signrawtransaction(tx1)["hex"])
tx2 = self.nodes[0].createrawtransaction([node0utxos.pop()], {self.nodes[1].getnewaddress(): 50}) tx2 = self.nodes[0].createrawtransaction([node0utxos.pop()], {self.nodes[1].getnewaddress(): 49.99})
txid2 = self.nodes[0].sendrawtransaction(self.nodes[0].signrawtransaction(tx2)["hex"]) txid2 = self.nodes[0].sendrawtransaction(self.nodes[0].signrawtransaction(tx2)["hex"])
assert_raises(JSONRPCException, self.nodes[0].gettxoutproof, [txid1]) assert_raises(JSONRPCException, self.nodes[0].gettxoutproof, [txid1])
@ -62,7 +62,7 @@ class MerkleBlockTest(BitcoinTestFramework):
assert_equal(self.nodes[2].verifytxoutproof(self.nodes[2].gettxoutproof([txid1, txid2], blockhash)), txlist) assert_equal(self.nodes[2].verifytxoutproof(self.nodes[2].gettxoutproof([txid1, txid2], blockhash)), txlist)
txin_spent = self.nodes[1].listunspent(1).pop() txin_spent = self.nodes[1].listunspent(1).pop()
tx3 = self.nodes[1].createrawtransaction([txin_spent], {self.nodes[0].getnewaddress(): 50}) tx3 = self.nodes[1].createrawtransaction([txin_spent], {self.nodes[0].getnewaddress(): 49.98})
self.nodes[0].sendrawtransaction(self.nodes[1].signrawtransaction(tx3)["hex"]) self.nodes[0].sendrawtransaction(self.nodes[1].signrawtransaction(tx3)["hex"])
self.nodes[0].generate(1) self.nodes[0].generate(1)
self.sync_all() self.sync_all()

3
qa/rpc-tests/test_framework/util.py

@ -240,8 +240,7 @@ def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=
datadir = os.path.join(dirname, "node"+str(i)) datadir = os.path.join(dirname, "node"+str(i))
if binary is None: if binary is None:
binary = os.getenv("BITCOIND", "bitcoind") binary = os.getenv("BITCOIND", "bitcoind")
# RPC tests still depend on free transactions args = [ binary, "-datadir="+datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-mocktime="+str(get_mocktime()) ]
args = [ binary, "-datadir="+datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-blockprioritysize=50000", "-mocktime="+str(get_mocktime()) ]
if extra_args is not None: args.extend(extra_args) if extra_args is not None: args.extend(extra_args)
bitcoind_processes[i] = subprocess.Popen(args) bitcoind_processes[i] = subprocess.Popen(args)
devnull = open(os.devnull, "w") devnull = open(os.devnull, "w")

9
qa/rpc-tests/wallet.py

@ -49,7 +49,6 @@ class WalletTest (BitcoinTestFramework):
assert_equal(self.nodes[2].getbalance(), 0) assert_equal(self.nodes[2].getbalance(), 0)
# Send 21 BTC from 0 to 2 using sendtoaddress call. # Send 21 BTC from 0 to 2 using sendtoaddress call.
# Second transaction will be child of first, and will require a fee
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 11) self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 11)
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 10) self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 10)
@ -81,7 +80,7 @@ class WalletTest (BitcoinTestFramework):
inputs = [] inputs = []
outputs = {} outputs = {}
inputs.append({ "txid" : utxo["txid"], "vout" : utxo["vout"]}) inputs.append({ "txid" : utxo["txid"], "vout" : utxo["vout"]})
outputs[self.nodes[2].getnewaddress("from1")] = utxo["amount"] outputs[self.nodes[2].getnewaddress("from1")] = utxo["amount"] - 3
raw_tx = self.nodes[0].createrawtransaction(inputs, outputs) raw_tx = self.nodes[0].createrawtransaction(inputs, outputs)
txns_to_send.append(self.nodes[0].signrawtransaction(raw_tx)) txns_to_send.append(self.nodes[0].signrawtransaction(raw_tx))
@ -94,8 +93,8 @@ class WalletTest (BitcoinTestFramework):
self.sync_all() self.sync_all()
assert_equal(self.nodes[0].getbalance(), 0) assert_equal(self.nodes[0].getbalance(), 0)
assert_equal(self.nodes[2].getbalance(), 100) assert_equal(self.nodes[2].getbalance(), 94)
assert_equal(self.nodes[2].getbalance("from1"), 100-21) assert_equal(self.nodes[2].getbalance("from1"), 94-21)
# Send 10 BTC normal # Send 10 BTC normal
address = self.nodes[0].getnewaddress("test") address = self.nodes[0].getnewaddress("test")
@ -104,7 +103,7 @@ class WalletTest (BitcoinTestFramework):
txid = self.nodes[2].sendtoaddress(address, 10, "", "", False) txid = self.nodes[2].sendtoaddress(address, 10, "", "", False)
self.nodes[2].generate(1) self.nodes[2].generate(1)
self.sync_all() self.sync_all()
node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), Decimal('90'), fee_per_byte, count_bytes(self.nodes[2].getrawtransaction(txid))) node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), Decimal('84'), fee_per_byte, count_bytes(self.nodes[2].getrawtransaction(txid)))
assert_equal(self.nodes[0].getbalance(), Decimal('10')) assert_equal(self.nodes[0].getbalance(), Decimal('10'))
# Send 10 BTC with subtract fee from amount # Send 10 BTC with subtract fee from amount

Loading…
Cancel
Save