Fix rpc tests broken by 2110 (#2118)

This commit is contained in:
UdjinM6 2018-06-12 21:37:31 +03:00 committed by GitHub
parent 836e104710
commit 806d7f0496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 19 deletions

View File

@ -120,7 +120,7 @@ class AddressIndexTest(BitcoinTestFramework):
tx.rehash() tx.rehash()
signed_tx = self.nodes[0].signrawtransaction(binascii.hexlify(tx.serialize()).decode("utf-8")) signed_tx = self.nodes[0].signrawtransaction(binascii.hexlify(tx.serialize()).decode("utf-8"))
sent_txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], True) sent_txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], True, False, True)
self.nodes[0].generate(1) self.nodes[0].generate(1)
self.sync_all() self.sync_all()
@ -149,7 +149,7 @@ class AddressIndexTest(BitcoinTestFramework):
tx.vout = [CTxOut(amount, scriptPubKey2)] tx.vout = [CTxOut(amount, scriptPubKey2)]
tx.rehash() tx.rehash()
signed_tx = self.nodes[0].signrawtransaction(binascii.hexlify(tx.serialize()).decode("utf-8")) signed_tx = self.nodes[0].signrawtransaction(binascii.hexlify(tx.serialize()).decode("utf-8"))
spending_txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], True) spending_txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], True, False, True)
self.nodes[0].generate(1) self.nodes[0].generate(1)
self.sync_all() self.sync_all()
balance1 = self.nodes[1].getaddressbalance(address2) balance1 = self.nodes[1].getaddressbalance(address2)
@ -163,7 +163,7 @@ class AddressIndexTest(BitcoinTestFramework):
tx.rehash() tx.rehash()
signed_tx = self.nodes[0].signrawtransaction(binascii.hexlify(tx.serialize()).decode("utf-8")) signed_tx = self.nodes[0].signrawtransaction(binascii.hexlify(tx.serialize()).decode("utf-8"))
sent_txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], True) sent_txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], True, False, True)
self.nodes[0].generate(1) self.nodes[0].generate(1)
self.sync_all() self.sync_all()
@ -245,7 +245,7 @@ class AddressIndexTest(BitcoinTestFramework):
tx.vout = [CTxOut(amount, scriptPubKey3)] tx.vout = [CTxOut(amount, scriptPubKey3)]
tx.rehash() tx.rehash()
signed_tx = self.nodes[2].signrawtransaction(binascii.hexlify(tx.serialize()).decode("utf-8")) signed_tx = self.nodes[2].signrawtransaction(binascii.hexlify(tx.serialize()).decode("utf-8"))
memtxid1 = self.nodes[2].sendrawtransaction(signed_tx["hex"], True) memtxid1 = self.nodes[2].sendrawtransaction(signed_tx["hex"], True, False, True)
set_mocktime(get_mocktime() + 2) set_mocktime(get_mocktime() + 2)
set_node_times(self.nodes, get_mocktime()) set_node_times(self.nodes, get_mocktime())
@ -260,7 +260,7 @@ class AddressIndexTest(BitcoinTestFramework):
] ]
tx2.rehash() tx2.rehash()
signed_tx2 = self.nodes[2].signrawtransaction(binascii.hexlify(tx2.serialize()).decode("utf-8")) signed_tx2 = self.nodes[2].signrawtransaction(binascii.hexlify(tx2.serialize()).decode("utf-8"))
memtxid2 = self.nodes[2].sendrawtransaction(signed_tx2["hex"], True) memtxid2 = self.nodes[2].sendrawtransaction(signed_tx2["hex"], True, False, True)
set_mocktime(get_mocktime() + 2) set_mocktime(get_mocktime() + 2)
set_node_times(self.nodes, get_mocktime()) set_node_times(self.nodes, get_mocktime())
@ -288,7 +288,7 @@ class AddressIndexTest(BitcoinTestFramework):
tx.rehash() tx.rehash()
self.nodes[2].importprivkey(privKey3) self.nodes[2].importprivkey(privKey3)
signed_tx3 = self.nodes[2].signrawtransaction(binascii.hexlify(tx.serialize()).decode("utf-8")) signed_tx3 = self.nodes[2].signrawtransaction(binascii.hexlify(tx.serialize()).decode("utf-8"))
memtxid3 = self.nodes[2].sendrawtransaction(signed_tx3["hex"], True) memtxid3 = self.nodes[2].sendrawtransaction(signed_tx3["hex"], True, False, True)
set_mocktime(get_mocktime() + 2) set_mocktime(get_mocktime() + 2)
set_node_times(self.nodes, get_mocktime()) set_node_times(self.nodes, get_mocktime())
@ -321,7 +321,7 @@ class AddressIndexTest(BitcoinTestFramework):
tx.rehash() tx.rehash()
self.nodes[0].importprivkey(privkey1) self.nodes[0].importprivkey(privkey1)
signed_tx = self.nodes[0].signrawtransaction(binascii.hexlify(tx.serialize()).decode("utf-8")) signed_tx = self.nodes[0].signrawtransaction(binascii.hexlify(tx.serialize()).decode("utf-8"))
mem_txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], True) mem_txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], True, False, True)
self.sync_all() self.sync_all()
mempool_deltas = self.nodes[2].getaddressmempool({"addresses": [address1]}) mempool_deltas = self.nodes[2].getaddressmempool({"addresses": [address1]})

View File

@ -41,13 +41,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 = [ create_tx(self.nodes[0], txid, node0_address, 500) for txid in coinbase_txids ] spends1_raw = [ create_tx(self.nodes[0], txid, node0_address, 500) for txid in coinbase_txids ]
spends1_id = [ self.nodes[0].sendrawtransaction(tx) for tx in spends1_raw ] spends1_id = [ self.nodes[0].sendrawtransaction(tx, False, False, True) for tx in spends1_raw ]
blocks = [] blocks = []
blocks.extend(self.nodes[0].generate(1)) blocks.extend(self.nodes[0].generate(1))
spends2_raw = [ create_tx(self.nodes[0], txid, node0_address, 499.99) for txid in spends1_id ] spends2_raw = [ create_tx(self.nodes[0], txid, node0_address, 499.99) for txid in spends1_id ]
spends2_id = [ self.nodes[0].sendrawtransaction(tx) for tx in spends2_raw ] spends2_id = [ self.nodes[0].sendrawtransaction(tx, False, False, True) for tx in spends2_raw ]
blocks.extend(self.nodes[0].generate(1)) blocks.extend(self.nodes[0].generate(1))

View File

@ -43,10 +43,10 @@ class MempoolSpendCoinbaseTest(BitcoinTestFramework):
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 = [ create_tx(self.nodes[0], txid, node0_address, 500) for txid in coinbase_txids ] spends_raw = [ create_tx(self.nodes[0], txid, node0_address, 500) 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], False, False, True)
# coinbase at height 102 should be too immature to spend # coinbase at height 102 should be too immature to spend
assert_raises(JSONRPCException, self.nodes[0].sendrawtransaction, spends_raw[1]) assert_raises(JSONRPCException, self.nodes[0].sendrawtransaction, spends_raw[1], False, False, True)
# mempool should have just spend_101: # mempool should have just spend_101:
assert_equal(self.nodes[0].getrawmempool(), [ spend_101_id ]) assert_equal(self.nodes[0].getrawmempool(), [ spend_101_id ])
@ -56,7 +56,7 @@ class MempoolSpendCoinbaseTest(BitcoinTestFramework):
assert_equal(set(self.nodes[0].getrawmempool()), set()) assert_equal(set(self.nodes[0].getrawmempool()), set())
# ... and now height 102 can be spent: # ... and now height 102 can be spent:
spend_102_id = self.nodes[0].sendrawtransaction(spends_raw[1]) spend_102_id = self.nodes[0].sendrawtransaction(spends_raw[1], False, False, True)
assert_equal(self.nodes[0].getrawmempool(), [ spend_102_id ]) assert_equal(self.nodes[0].getrawmempool(), [ spend_102_id ])
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -44,9 +44,9 @@ class MerkleBlockTest(BitcoinTestFramework):
node0utxos = self.nodes[0].listunspent(1) node0utxos = self.nodes[0].listunspent(1)
tx1 = self.nodes[0].createrawtransaction([node0utxos.pop()], {self.nodes[1].getnewaddress(): 500}) tx1 = self.nodes[0].createrawtransaction([node0utxos.pop()], {self.nodes[1].getnewaddress(): 500})
txid1 = self.nodes[0].sendrawtransaction(self.nodes[0].signrawtransaction(tx1)["hex"]) txid1 = self.nodes[0].sendrawtransaction(self.nodes[0].signrawtransaction(tx1)["hex"], False, False, True)
tx2 = self.nodes[0].createrawtransaction([node0utxos.pop()], {self.nodes[1].getnewaddress(): 500}) tx2 = self.nodes[0].createrawtransaction([node0utxos.pop()], {self.nodes[1].getnewaddress(): 500})
txid2 = self.nodes[0].sendrawtransaction(self.nodes[0].signrawtransaction(tx2)["hex"]) txid2 = self.nodes[0].sendrawtransaction(self.nodes[0].signrawtransaction(tx2)["hex"], False, False, True)
assert_raises(JSONRPCException, self.nodes[0].gettxoutproof, [txid1]) assert_raises(JSONRPCException, self.nodes[0].gettxoutproof, [txid1])
self.nodes[0].generate(1) self.nodes[0].generate(1)
@ -64,7 +64,7 @@ class MerkleBlockTest(BitcoinTestFramework):
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(): 500}) tx3 = self.nodes[1].createrawtransaction([txin_spent], {self.nodes[0].getnewaddress(): 500})
self.nodes[0].sendrawtransaction(self.nodes[1].signrawtransaction(tx3)["hex"]) self.nodes[0].sendrawtransaction(self.nodes[1].signrawtransaction(tx3)["hex"], False, False, True)
self.nodes[0].generate(1) self.nodes[0].generate(1)
self.sync_all() self.sync_all()

View File

@ -58,7 +58,7 @@ class SpentIndexTest(BitcoinTestFramework):
tx.rehash() tx.rehash()
signed_tx = self.nodes[0].signrawtransaction(binascii.hexlify(tx.serialize()).decode("utf-8")) signed_tx = self.nodes[0].signrawtransaction(binascii.hexlify(tx.serialize()).decode("utf-8"))
txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], True) txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], True, False, True)
self.nodes[0].generate(1) self.nodes[0].generate(1)
self.sync_all() self.sync_all()
@ -94,7 +94,7 @@ class SpentIndexTest(BitcoinTestFramework):
tx2.rehash() tx2.rehash()
self.nodes[0].importprivkey(privkey) self.nodes[0].importprivkey(privkey)
signed_tx2 = self.nodes[0].signrawtransaction(binascii.hexlify(tx2.serialize()).decode("utf-8")) signed_tx2 = self.nodes[0].signrawtransaction(binascii.hexlify(tx2.serialize()).decode("utf-8"))
txid2 = self.nodes[0].sendrawtransaction(signed_tx2["hex"], True) txid2 = self.nodes[0].sendrawtransaction(signed_tx2["hex"], True, False, True)
# Check the mempool index # Check the mempool index
self.sync_all() self.sync_all()

View File

@ -103,8 +103,8 @@ class WalletTest (BitcoinTestFramework):
txns_to_send.append(self.nodes[0].signrawtransaction(raw_tx)) txns_to_send.append(self.nodes[0].signrawtransaction(raw_tx))
# Have node 1 (miner) send the transactions # Have node 1 (miner) send the transactions
self.nodes[1].sendrawtransaction(txns_to_send[0]["hex"], True) self.nodes[1].sendrawtransaction(txns_to_send[0]["hex"], True, False, True)
self.nodes[1].sendrawtransaction(txns_to_send[1]["hex"], True) self.nodes[1].sendrawtransaction(txns_to_send[1]["hex"], True, False, True)
# Have node1 mine a block to confirm transactions: # Have node1 mine a block to confirm transactions:
self.nodes[1].generate(1) self.nodes[1].generate(1)