scripted-diff: change signrawtransaction to signrawtransactionwithwallet in tests
-BEGIN VERIFY SCRIPT- sed -i 's/\<signrawtransaction\>/signrawtransactionwithwallet/g' test/functional/*.py sed -i 's/\<signrawtransaction\>/signrawtransactionwithwallet/g' test/functional/test_framework/*.py -END VERIFY SCRIPT-
This commit is contained in:
parent
1e79c055cd
commit
eefff65a4b
25 changed files with 62 additions and 62 deletions
|
@ -70,7 +70,7 @@ class BIP68Test(BitcoinTestFramework):
|
||||||
tx1.vin = [CTxIn(COutPoint(int(utxo["txid"], 16), utxo["vout"]), nSequence=sequence_value)]
|
tx1.vin = [CTxIn(COutPoint(int(utxo["txid"], 16), utxo["vout"]), nSequence=sequence_value)]
|
||||||
tx1.vout = [CTxOut(value, CScript([b'a']))]
|
tx1.vout = [CTxOut(value, CScript([b'a']))]
|
||||||
|
|
||||||
tx1_signed = self.nodes[0].signrawtransaction(ToHex(tx1))["hex"]
|
tx1_signed = self.nodes[0].signrawtransactionwithwallet(ToHex(tx1))["hex"]
|
||||||
tx1_id = self.nodes[0].sendrawtransaction(tx1_signed)
|
tx1_id = self.nodes[0].sendrawtransaction(tx1_signed)
|
||||||
tx1_id = int(tx1_id, 16)
|
tx1_id = int(tx1_id, 16)
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ class BIP68Test(BitcoinTestFramework):
|
||||||
# Overestimate the size of the tx - signatures should be less than 120 bytes, and leave 50 for the output
|
# Overestimate the size of the tx - signatures should be less than 120 bytes, and leave 50 for the output
|
||||||
tx_size = len(ToHex(tx))//2 + 120*num_inputs + 50
|
tx_size = len(ToHex(tx))//2 + 120*num_inputs + 50
|
||||||
tx.vout.append(CTxOut(int(value-self.relayfee*tx_size*COIN/1000), CScript([b'a'])))
|
tx.vout.append(CTxOut(int(value-self.relayfee*tx_size*COIN/1000), CScript([b'a'])))
|
||||||
rawtx = self.nodes[0].signrawtransaction(ToHex(tx))["hex"]
|
rawtx = self.nodes[0].signrawtransactionwithwallet(ToHex(tx))["hex"]
|
||||||
|
|
||||||
if (using_sequence_locks and not should_pass):
|
if (using_sequence_locks and not should_pass):
|
||||||
# This transaction should be rejected
|
# This transaction should be rejected
|
||||||
|
@ -205,7 +205,7 @@ class BIP68Test(BitcoinTestFramework):
|
||||||
tx2.nVersion = 2
|
tx2.nVersion = 2
|
||||||
tx2.vin = [CTxIn(COutPoint(tx1.sha256, 0), nSequence=0)]
|
tx2.vin = [CTxIn(COutPoint(tx1.sha256, 0), nSequence=0)]
|
||||||
tx2.vout = [CTxOut(int(tx1.vout[0].nValue - self.relayfee*COIN), CScript([b'a']))]
|
tx2.vout = [CTxOut(int(tx1.vout[0].nValue - self.relayfee*COIN), CScript([b'a']))]
|
||||||
tx2_raw = self.nodes[0].signrawtransaction(ToHex(tx2))["hex"]
|
tx2_raw = self.nodes[0].signrawtransactionwithwallet(ToHex(tx2))["hex"]
|
||||||
tx2 = FromHex(tx2, tx2_raw)
|
tx2 = FromHex(tx2, tx2_raw)
|
||||||
tx2.rehash()
|
tx2.rehash()
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ class BIP68Test(BitcoinTestFramework):
|
||||||
utxos = self.nodes[0].listunspent()
|
utxos = self.nodes[0].listunspent()
|
||||||
tx5.vin.append(CTxIn(COutPoint(int(utxos[0]["txid"], 16), utxos[0]["vout"]), nSequence=1))
|
tx5.vin.append(CTxIn(COutPoint(int(utxos[0]["txid"], 16), utxos[0]["vout"]), nSequence=1))
|
||||||
tx5.vout[0].nValue += int(utxos[0]["amount"]*COIN)
|
tx5.vout[0].nValue += int(utxos[0]["amount"]*COIN)
|
||||||
raw_tx5 = self.nodes[0].signrawtransaction(ToHex(tx5))["hex"]
|
raw_tx5 = self.nodes[0].signrawtransactionwithwallet(ToHex(tx5))["hex"]
|
||||||
|
|
||||||
assert_raises_rpc_error(-26, NOT_FINAL_ERROR, self.nodes[0].sendrawtransaction, raw_tx5)
|
assert_raises_rpc_error(-26, NOT_FINAL_ERROR, self.nodes[0].sendrawtransaction, raw_tx5)
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ class BIP68Test(BitcoinTestFramework):
|
||||||
tx2.vout = [CTxOut(int(tx1.vout[0].nValue - self.relayfee*COIN), CScript([b'a']))]
|
tx2.vout = [CTxOut(int(tx1.vout[0].nValue - self.relayfee*COIN), CScript([b'a']))]
|
||||||
|
|
||||||
# sign tx2
|
# sign tx2
|
||||||
tx2_raw = self.nodes[0].signrawtransaction(ToHex(tx2))["hex"]
|
tx2_raw = self.nodes[0].signrawtransactionwithwallet(ToHex(tx2))["hex"]
|
||||||
tx2 = FromHex(tx2, tx2_raw)
|
tx2 = FromHex(tx2, tx2_raw)
|
||||||
tx2.rehash()
|
tx2.rehash()
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ class BIP68Test(BitcoinTestFramework):
|
||||||
rawtxfund = self.nodes[1].fundrawtransaction(rawtx)['hex']
|
rawtxfund = self.nodes[1].fundrawtransaction(rawtx)['hex']
|
||||||
tx = FromHex(CTransaction(), rawtxfund)
|
tx = FromHex(CTransaction(), rawtxfund)
|
||||||
tx.nVersion = 2
|
tx.nVersion = 2
|
||||||
tx_signed = self.nodes[1].signrawtransaction(ToHex(tx))["hex"]
|
tx_signed = self.nodes[1].signrawtransactionwithwallet(ToHex(tx))["hex"]
|
||||||
self.nodes[1].sendrawtransaction(tx_signed)
|
self.nodes[1].sendrawtransaction(tx_signed)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -51,7 +51,7 @@ class BIP9SoftForksTest(ComparisonTestFramework):
|
||||||
return tx
|
return tx
|
||||||
|
|
||||||
def sign_transaction(self, node, tx):
|
def sign_transaction(self, node, tx):
|
||||||
signresult = node.signrawtransaction(bytes_to_hex_str(tx.serialize()))
|
signresult = node.signrawtransactionwithwallet(bytes_to_hex_str(tx.serialize()))
|
||||||
tx = CTransaction()
|
tx = CTransaction()
|
||||||
f = BytesIO(hex_str_to_bytes(signresult['hex']))
|
f = BytesIO(hex_str_to_bytes(signresult['hex']))
|
||||||
tx.deserialize(f)
|
tx.deserialize(f)
|
||||||
|
|
|
@ -41,7 +41,7 @@ def cltv_validate(node, tx, height):
|
||||||
tx.nLockTime = height
|
tx.nLockTime = height
|
||||||
|
|
||||||
# Need to re-sign, since nSequence and nLockTime changed
|
# Need to re-sign, since nSequence and nLockTime changed
|
||||||
signed_result = node.signrawtransaction(ToHex(tx))
|
signed_result = node.signrawtransactionwithwallet(ToHex(tx))
|
||||||
new_tx = CTransaction()
|
new_tx = CTransaction()
|
||||||
new_tx.deserialize(BytesIO(hex_str_to_bytes(signed_result['hex'])))
|
new_tx.deserialize(BytesIO(hex_str_to_bytes(signed_result['hex'])))
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ def create_transaction(node, coinbase, to_address, amount):
|
||||||
inputs = [{ "txid" : from_txid, "vout" : 0}]
|
inputs = [{ "txid" : from_txid, "vout" : 0}]
|
||||||
outputs = { to_address : amount }
|
outputs = { to_address : amount }
|
||||||
rawtx = node.createrawtransaction(inputs, outputs)
|
rawtx = node.createrawtransaction(inputs, outputs)
|
||||||
signresult = node.signrawtransaction(rawtx)
|
signresult = node.signrawtransactionwithwallet(rawtx)
|
||||||
tx = CTransaction()
|
tx = CTransaction()
|
||||||
tx.deserialize(BytesIO(hex_str_to_bytes(signresult['hex'])))
|
tx.deserialize(BytesIO(hex_str_to_bytes(signresult['hex'])))
|
||||||
return tx
|
return tx
|
||||||
|
|
|
@ -118,7 +118,7 @@ class BIP68_112_113Test(ComparisonTestFramework):
|
||||||
|
|
||||||
def sign_transaction(self, node, unsignedtx):
|
def sign_transaction(self, node, unsignedtx):
|
||||||
rawtx = ToHex(unsignedtx)
|
rawtx = ToHex(unsignedtx)
|
||||||
signresult = node.signrawtransaction(rawtx)
|
signresult = node.signrawtransactionwithwallet(rawtx)
|
||||||
tx = CTransaction()
|
tx = CTransaction()
|
||||||
f = BytesIO(hex_str_to_bytes(signresult['hex']))
|
f = BytesIO(hex_str_to_bytes(signresult['hex']))
|
||||||
tx.deserialize(f)
|
tx.deserialize(f)
|
||||||
|
|
|
@ -206,7 +206,7 @@ class ChainstateWriteCrashTest(BitcoinTestFramework):
|
||||||
tx.vout.append(CTxOut(output_amount, hex_str_to_bytes(utxo['scriptPubKey'])))
|
tx.vout.append(CTxOut(output_amount, hex_str_to_bytes(utxo['scriptPubKey'])))
|
||||||
|
|
||||||
# Sign and send the transaction to get into the mempool
|
# Sign and send the transaction to get into the mempool
|
||||||
tx_signed_hex = node.signrawtransaction(ToHex(tx))['hex']
|
tx_signed_hex = node.signrawtransactionwithwallet(ToHex(tx))['hex']
|
||||||
node.sendrawtransaction(tx_signed_hex)
|
node.sendrawtransaction(tx_signed_hex)
|
||||||
num_transactions += 1
|
num_transactions += 1
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ def create_transaction(node, coinbase, to_address, amount):
|
||||||
inputs = [{ "txid" : from_txid, "vout" : 0}]
|
inputs = [{ "txid" : from_txid, "vout" : 0}]
|
||||||
outputs = { to_address : amount }
|
outputs = { to_address : amount }
|
||||||
rawtx = node.createrawtransaction(inputs, outputs)
|
rawtx = node.createrawtransaction(inputs, outputs)
|
||||||
signresult = node.signrawtransaction(rawtx)
|
signresult = node.signrawtransactionwithwallet(rawtx)
|
||||||
tx = CTransaction()
|
tx = CTransaction()
|
||||||
tx.deserialize(BytesIO(hex_str_to_bytes(signresult['hex'])))
|
tx.deserialize(BytesIO(hex_str_to_bytes(signresult['hex'])))
|
||||||
return tx
|
return tx
|
||||||
|
|
|
@ -91,7 +91,7 @@ def split_inputs(from_node, txins, txouts, initial_split=False):
|
||||||
# If this is the initial split we actually need to sign the transaction
|
# If this is the initial split we actually need to sign the transaction
|
||||||
# Otherwise we just need to insert the proper ScriptSig
|
# Otherwise we just need to insert the proper ScriptSig
|
||||||
if (initial_split):
|
if (initial_split):
|
||||||
completetx = from_node.signrawtransaction(ToHex(tx))["hex"]
|
completetx = from_node.signrawtransactionwithwallet(ToHex(tx))["hex"]
|
||||||
else:
|
else:
|
||||||
tx.vin[0].scriptSig = SCRIPT_SIG[prevtxout["vout"]]
|
tx.vin[0].scriptSig = SCRIPT_SIG[prevtxout["vout"]]
|
||||||
completetx = ToHex(tx)
|
completetx = ToHex(tx)
|
||||||
|
|
|
@ -102,7 +102,7 @@ class NULLDUMMYTest(BitcoinTestFramework):
|
||||||
inputs = [{ "txid" : txid, "vout" : 0}]
|
inputs = [{ "txid" : txid, "vout" : 0}]
|
||||||
outputs = { to_address : amount }
|
outputs = { to_address : amount }
|
||||||
rawtx = node.createrawtransaction(inputs, outputs)
|
rawtx = node.createrawtransaction(inputs, outputs)
|
||||||
signresult = node.signrawtransaction(rawtx)
|
signresult = node.signrawtransactionwithwallet(rawtx)
|
||||||
tx = CTransaction()
|
tx = CTransaction()
|
||||||
f = BytesIO(hex_str_to_bytes(signresult['hex']))
|
f = BytesIO(hex_str_to_bytes(signresult['hex']))
|
||||||
tx.deserialize(f)
|
tx.deserialize(f)
|
||||||
|
|
|
@ -42,7 +42,7 @@ def make_utxo(node, amount, confirmed=True, scriptPubKey=CScript([1])):
|
||||||
tx2.vout = [CTxOut(amount, scriptPubKey)]
|
tx2.vout = [CTxOut(amount, scriptPubKey)]
|
||||||
tx2.rehash()
|
tx2.rehash()
|
||||||
|
|
||||||
signed_tx = node.signrawtransaction(txToHex(tx2))
|
signed_tx = node.signrawtransactionwithwallet(txToHex(tx2))
|
||||||
|
|
||||||
txid = node.sendrawtransaction(signed_tx['hex'], True)
|
txid = node.sendrawtransaction(signed_tx['hex'], True)
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,7 @@ class SegWitTest(BitcoinTestFramework):
|
||||||
tx = CTransaction()
|
tx = CTransaction()
|
||||||
tx.vin.append(CTxIn(COutPoint(int(txid1, 16), 0), b''))
|
tx.vin.append(CTxIn(COutPoint(int(txid1, 16), 0), b''))
|
||||||
tx.vout.append(CTxOut(int(49.99*COIN), CScript([OP_TRUE])))
|
tx.vout.append(CTxOut(int(49.99*COIN), CScript([OP_TRUE])))
|
||||||
tx2_hex = self.nodes[0].signrawtransaction(ToHex(tx))['hex']
|
tx2_hex = self.nodes[0].signrawtransactionwithwallet(ToHex(tx))['hex']
|
||||||
txid2 = self.nodes[0].sendrawtransaction(tx2_hex)
|
txid2 = self.nodes[0].sendrawtransaction(tx2_hex)
|
||||||
tx = FromHex(CTransaction(), tx2_hex)
|
tx = FromHex(CTransaction(), tx2_hex)
|
||||||
assert(not tx.wit.is_null())
|
assert(not tx.wit.is_null())
|
||||||
|
@ -559,7 +559,7 @@ class SegWitTest(BitcoinTestFramework):
|
||||||
|
|
||||||
self.nodes[1].importaddress(scriptPubKey, "", False)
|
self.nodes[1].importaddress(scriptPubKey, "", False)
|
||||||
rawtxfund = self.nodes[1].fundrawtransaction(transaction)['hex']
|
rawtxfund = self.nodes[1].fundrawtransaction(transaction)['hex']
|
||||||
rawtxfund = self.nodes[1].signrawtransaction(rawtxfund)["hex"]
|
rawtxfund = self.nodes[1].signrawtransactionwithwallet(rawtxfund)["hex"]
|
||||||
txid = self.nodes[1].sendrawtransaction(rawtxfund)
|
txid = self.nodes[1].sendrawtransaction(rawtxfund)
|
||||||
|
|
||||||
assert_equal(self.nodes[1].gettransaction(txid, True)["txid"], txid)
|
assert_equal(self.nodes[1].gettransaction(txid, True)["txid"], txid)
|
||||||
|
@ -578,7 +578,7 @@ class SegWitTest(BitcoinTestFramework):
|
||||||
for i in script_list:
|
for i in script_list:
|
||||||
tx.vout.append(CTxOut(10000000, i))
|
tx.vout.append(CTxOut(10000000, i))
|
||||||
tx.rehash()
|
tx.rehash()
|
||||||
signresults = self.nodes[0].signrawtransaction(bytes_to_hex_str(tx.serialize_without_witness()))['hex']
|
signresults = self.nodes[0].signrawtransactionwithwallet(bytes_to_hex_str(tx.serialize_without_witness()))['hex']
|
||||||
txid = self.nodes[0].sendrawtransaction(signresults, True)
|
txid = self.nodes[0].sendrawtransaction(signresults, True)
|
||||||
self.nodes[0].generate(1)
|
self.nodes[0].generate(1)
|
||||||
sync_blocks(self.nodes)
|
sync_blocks(self.nodes)
|
||||||
|
@ -630,7 +630,7 @@ class SegWitTest(BitcoinTestFramework):
|
||||||
tx.vin.append(CTxIn(COutPoint(int('0x'+i,0), j)))
|
tx.vin.append(CTxIn(COutPoint(int('0x'+i,0), j)))
|
||||||
tx.vout.append(CTxOut(0, CScript()))
|
tx.vout.append(CTxOut(0, CScript()))
|
||||||
tx.rehash()
|
tx.rehash()
|
||||||
signresults = self.nodes[0].signrawtransaction(bytes_to_hex_str(tx.serialize_without_witness()))['hex']
|
signresults = self.nodes[0].signrawtransactionwithwallet(bytes_to_hex_str(tx.serialize_without_witness()))['hex']
|
||||||
self.nodes[0].sendrawtransaction(signresults, True)
|
self.nodes[0].sendrawtransaction(signresults, True)
|
||||||
self.nodes[0].generate(1)
|
self.nodes[0].generate(1)
|
||||||
sync_blocks(self.nodes)
|
sync_blocks(self.nodes)
|
||||||
|
|
|
@ -32,7 +32,7 @@ class MempoolLimitTest(BitcoinTestFramework):
|
||||||
self.nodes[0].settxfee(relayfee) # specifically fund this tx with low fee
|
self.nodes[0].settxfee(relayfee) # specifically fund this tx with low fee
|
||||||
txF = self.nodes[0].fundrawtransaction(tx)
|
txF = self.nodes[0].fundrawtransaction(tx)
|
||||||
self.nodes[0].settxfee(0) # return to automatic fee selection
|
self.nodes[0].settxfee(0) # return to automatic fee selection
|
||||||
txFS = self.nodes[0].signrawtransaction(txF['hex'])
|
txFS = self.nodes[0].signrawtransactionwithwallet(txF['hex'])
|
||||||
txid = self.nodes[0].sendrawtransaction(txFS['hex'])
|
txid = self.nodes[0].sendrawtransaction(txFS['hex'])
|
||||||
|
|
||||||
relayfee = self.nodes[0].getnetworkinfo()['relayfee']
|
relayfee = self.nodes[0].getnetworkinfo()['relayfee']
|
||||||
|
@ -57,7 +57,7 @@ class MempoolLimitTest(BitcoinTestFramework):
|
||||||
tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||||
# specifically fund this tx with a fee < mempoolminfee, >= than minrelaytxfee
|
# specifically fund this tx with a fee < mempoolminfee, >= than minrelaytxfee
|
||||||
txF = self.nodes[0].fundrawtransaction(tx, {'feeRate': relayfee})
|
txF = self.nodes[0].fundrawtransaction(tx, {'feeRate': relayfee})
|
||||||
txFS = self.nodes[0].signrawtransaction(txF['hex'])
|
txFS = self.nodes[0].signrawtransactionwithwallet(txF['hex'])
|
||||||
assert_raises_rpc_error(-26, "mempool min fee not met, 166 < 411 (code 66)", self.nodes[0].sendrawtransaction, txFS['hex'])
|
assert_raises_rpc_error(-26, "mempool min fee not met, 166 < 411 (code 66)", self.nodes[0].sendrawtransaction, txFS['hex'])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -25,7 +25,7 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||||
for i in range(num_outputs):
|
for i in range(num_outputs):
|
||||||
outputs[node.getnewaddress()] = send_value
|
outputs[node.getnewaddress()] = send_value
|
||||||
rawtx = node.createrawtransaction(inputs, outputs)
|
rawtx = node.createrawtransaction(inputs, outputs)
|
||||||
signedtx = node.signrawtransaction(rawtx)
|
signedtx = node.signrawtransactionwithwallet(rawtx)
|
||||||
txid = node.sendrawtransaction(signedtx['hex'])
|
txid = node.sendrawtransaction(signedtx['hex'])
|
||||||
fulltx = node.getrawtransaction(txid, 1)
|
fulltx = node.getrawtransaction(txid, 1)
|
||||||
assert(len(fulltx['vout']) == num_outputs) # make sure we didn't generate a change output
|
assert(len(fulltx['vout']) == num_outputs) # make sure we didn't generate a change output
|
||||||
|
@ -205,7 +205,7 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
outputs[self.nodes[0].getnewaddress()] = send_value
|
outputs[self.nodes[0].getnewaddress()] = send_value
|
||||||
rawtx = self.nodes[0].createrawtransaction(inputs, outputs)
|
rawtx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||||
signedtx = self.nodes[0].signrawtransaction(rawtx)
|
signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx)
|
||||||
txid = self.nodes[0].sendrawtransaction(signedtx['hex'])
|
txid = self.nodes[0].sendrawtransaction(signedtx['hex'])
|
||||||
tx0_id = txid
|
tx0_id = txid
|
||||||
value = send_value
|
value = send_value
|
||||||
|
@ -229,7 +229,7 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||||
inputs = [ {'txid' : tx1_id, 'vout': 0}, {'txid' : txid, 'vout': 0} ]
|
inputs = [ {'txid' : tx1_id, 'vout': 0}, {'txid' : txid, 'vout': 0} ]
|
||||||
outputs = { self.nodes[0].getnewaddress() : send_value + value - 4*fee }
|
outputs = { self.nodes[0].getnewaddress() : send_value + value - 4*fee }
|
||||||
rawtx = self.nodes[0].createrawtransaction(inputs, outputs)
|
rawtx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||||
signedtx = self.nodes[0].signrawtransaction(rawtx)
|
signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx)
|
||||||
txid = self.nodes[0].sendrawtransaction(signedtx['hex'])
|
txid = self.nodes[0].sendrawtransaction(signedtx['hex'])
|
||||||
sync_mempools(self.nodes)
|
sync_mempools(self.nodes)
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||||
# Set the time lock
|
# Set the time lock
|
||||||
timelock_tx = timelock_tx.replace("ffffffff", "11111191", 1)
|
timelock_tx = timelock_tx.replace("ffffffff", "11111191", 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"
|
||||||
timelock_tx = self.nodes[0].signrawtransaction(timelock_tx)["hex"]
|
timelock_tx = self.nodes[0].signrawtransactionwithwallet(timelock_tx)["hex"]
|
||||||
# This will raise an exception because the timelock transaction is too immature to spend
|
# This will raise an exception because the timelock transaction is too immature to spend
|
||||||
assert_raises_rpc_error(-26, "non-final", self.nodes[0].sendrawtransaction, timelock_tx)
|
assert_raises_rpc_error(-26, "non-final", self.nodes[0].sendrawtransaction, timelock_tx)
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ class PrioritiseTransactionTest(BitcoinTestFramework):
|
||||||
inputs.append({"txid" : utxo["txid"], "vout" : utxo["vout"]})
|
inputs.append({"txid" : utxo["txid"], "vout" : utxo["vout"]})
|
||||||
outputs[self.nodes[0].getnewaddress()] = utxo["amount"]
|
outputs[self.nodes[0].getnewaddress()] = utxo["amount"]
|
||||||
raw_tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
raw_tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||||
tx_hex = self.nodes[0].signrawtransaction(raw_tx)["hex"]
|
tx_hex = self.nodes[0].signrawtransactionwithwallet(raw_tx)["hex"]
|
||||||
tx_id = self.nodes[0].decoderawtransaction(tx_hex)["txid"]
|
tx_id = self.nodes[0].decoderawtransaction(tx_hex)["txid"]
|
||||||
|
|
||||||
# This will raise an exception due to min relay fee not being met
|
# This will raise an exception due to min relay fee not being met
|
||||||
|
|
|
@ -449,7 +449,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||||
fundedTx = self.nodes[2].fundrawtransaction(rawtx)
|
fundedTx = self.nodes[2].fundrawtransaction(rawtx)
|
||||||
|
|
||||||
signedTx = self.nodes[2].signrawtransaction(fundedTx['hex'])
|
signedTx = self.nodes[2].signrawtransactionwithwallet(fundedTx['hex'])
|
||||||
txId = self.nodes[2].sendrawtransaction(signedTx['hex'])
|
txId = self.nodes[2].sendrawtransaction(signedTx['hex'])
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
self.nodes[1].generate(1)
|
self.nodes[1].generate(1)
|
||||||
|
@ -503,7 +503,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
|
|
||||||
#now we need to unlock
|
#now we need to unlock
|
||||||
self.nodes[1].walletpassphrase("test", 600)
|
self.nodes[1].walletpassphrase("test", 600)
|
||||||
signedTx = self.nodes[1].signrawtransaction(fundedTx['hex'])
|
signedTx = self.nodes[1].signrawtransactionwithwallet(fundedTx['hex'])
|
||||||
txId = self.nodes[1].sendrawtransaction(signedTx['hex'])
|
txId = self.nodes[1].sendrawtransaction(signedTx['hex'])
|
||||||
self.nodes[1].generate(1)
|
self.nodes[1].generate(1)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
@ -564,7 +564,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
outputs = {self.nodes[0].getnewaddress():0.15,self.nodes[0].getnewaddress():0.04}
|
outputs = {self.nodes[0].getnewaddress():0.15,self.nodes[0].getnewaddress():0.04}
|
||||||
rawtx = self.nodes[1].createrawtransaction(inputs, outputs)
|
rawtx = self.nodes[1].createrawtransaction(inputs, outputs)
|
||||||
fundedTx = self.nodes[1].fundrawtransaction(rawtx)
|
fundedTx = self.nodes[1].fundrawtransaction(rawtx)
|
||||||
fundedAndSignedTx = self.nodes[1].signrawtransaction(fundedTx['hex'])
|
fundedAndSignedTx = self.nodes[1].signrawtransactionwithwallet(fundedTx['hex'])
|
||||||
txId = self.nodes[1].sendrawtransaction(fundedAndSignedTx['hex'])
|
txId = self.nodes[1].sendrawtransaction(fundedAndSignedTx['hex'])
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
self.nodes[0].generate(1)
|
self.nodes[0].generate(1)
|
||||||
|
@ -622,9 +622,9 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
assert_greater_than(result["changepos"], -1)
|
assert_greater_than(result["changepos"], -1)
|
||||||
assert_equal(result["fee"] + res_dec["vout"][result["changepos"]]["value"], watchonly_amount / 10)
|
assert_equal(result["fee"] + res_dec["vout"][result["changepos"]]["value"], watchonly_amount / 10)
|
||||||
|
|
||||||
signedtx = self.nodes[3].signrawtransaction(result["hex"])
|
signedtx = self.nodes[3].signrawtransactionwithwallet(result["hex"])
|
||||||
assert(not signedtx["complete"])
|
assert(not signedtx["complete"])
|
||||||
signedtx = self.nodes[0].signrawtransaction(signedtx["hex"])
|
signedtx = self.nodes[0].signrawtransactionwithwallet(signedtx["hex"])
|
||||||
assert(signedtx["complete"])
|
assert(signedtx["complete"])
|
||||||
self.nodes[0].sendrawtransaction(signedtx["hex"])
|
self.nodes[0].sendrawtransaction(signedtx["hex"])
|
||||||
self.nodes[0].generate(1)
|
self.nodes[0].generate(1)
|
||||||
|
|
|
@ -131,7 +131,7 @@ class ListTransactionsTest(BitcoinTestFramework):
|
||||||
inputs = [{"txid":utxo_to_use["txid"], "vout":utxo_to_use["vout"]}]
|
inputs = [{"txid":utxo_to_use["txid"], "vout":utxo_to_use["vout"]}]
|
||||||
outputs = {self.nodes[0].getnewaddress(): 0.999}
|
outputs = {self.nodes[0].getnewaddress(): 0.999}
|
||||||
tx2 = self.nodes[1].createrawtransaction(inputs, outputs)
|
tx2 = self.nodes[1].createrawtransaction(inputs, outputs)
|
||||||
tx2_signed = self.nodes[1].signrawtransaction(tx2)["hex"]
|
tx2_signed = self.nodes[1].signrawtransactionwithwallet(tx2)["hex"]
|
||||||
txid_2 = self.nodes[1].sendrawtransaction(tx2_signed)
|
txid_2 = self.nodes[1].sendrawtransaction(tx2_signed)
|
||||||
|
|
||||||
# ...and check the result
|
# ...and check the result
|
||||||
|
@ -148,7 +148,7 @@ class ListTransactionsTest(BitcoinTestFramework):
|
||||||
tx3_modified = txFromHex(tx3)
|
tx3_modified = txFromHex(tx3)
|
||||||
tx3_modified.vin[0].nSequence = 0
|
tx3_modified.vin[0].nSequence = 0
|
||||||
tx3 = bytes_to_hex_str(tx3_modified.serialize())
|
tx3 = bytes_to_hex_str(tx3_modified.serialize())
|
||||||
tx3_signed = self.nodes[0].signrawtransaction(tx3)['hex']
|
tx3_signed = self.nodes[0].signrawtransactionwithwallet(tx3)['hex']
|
||||||
txid_3 = self.nodes[0].sendrawtransaction(tx3_signed)
|
txid_3 = self.nodes[0].sendrawtransaction(tx3_signed)
|
||||||
|
|
||||||
assert(is_opt_in(self.nodes[0], txid_3))
|
assert(is_opt_in(self.nodes[0], txid_3))
|
||||||
|
@ -162,7 +162,7 @@ class ListTransactionsTest(BitcoinTestFramework):
|
||||||
inputs = [{"txid": txid_3, "vout":utxo_to_use["vout"]}]
|
inputs = [{"txid": txid_3, "vout":utxo_to_use["vout"]}]
|
||||||
outputs = {self.nodes[0].getnewaddress(): 0.997}
|
outputs = {self.nodes[0].getnewaddress(): 0.997}
|
||||||
tx4 = self.nodes[1].createrawtransaction(inputs, outputs)
|
tx4 = self.nodes[1].createrawtransaction(inputs, outputs)
|
||||||
tx4_signed = self.nodes[1].signrawtransaction(tx4)["hex"]
|
tx4_signed = self.nodes[1].signrawtransactionwithwallet(tx4)["hex"]
|
||||||
txid_4 = self.nodes[1].sendrawtransaction(tx4_signed)
|
txid_4 = self.nodes[1].sendrawtransaction(tx4_signed)
|
||||||
|
|
||||||
assert(not is_opt_in(self.nodes[1], txid_4))
|
assert(not is_opt_in(self.nodes[1], txid_4))
|
||||||
|
@ -174,7 +174,7 @@ class ListTransactionsTest(BitcoinTestFramework):
|
||||||
tx3_b = tx3_modified
|
tx3_b = tx3_modified
|
||||||
tx3_b.vout[0].nValue -= int(Decimal("0.004") * COIN) # bump the fee
|
tx3_b.vout[0].nValue -= int(Decimal("0.004") * COIN) # bump the fee
|
||||||
tx3_b = bytes_to_hex_str(tx3_b.serialize())
|
tx3_b = bytes_to_hex_str(tx3_b.serialize())
|
||||||
tx3_b_signed = self.nodes[0].signrawtransaction(tx3_b)['hex']
|
tx3_b_signed = self.nodes[0].signrawtransactionwithwallet(tx3_b)['hex']
|
||||||
txid_3b = self.nodes[0].sendrawtransaction(tx3_b_signed, True)
|
txid_3b = self.nodes[0].sendrawtransaction(tx3_b_signed, True)
|
||||||
assert(is_opt_in(self.nodes[0], txid_3b))
|
assert(is_opt_in(self.nodes[0], txid_3b))
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
Test the following RPCs:
|
Test the following RPCs:
|
||||||
- createrawtransaction
|
- createrawtransaction
|
||||||
- signrawtransaction
|
- signrawtransactionwithwallet
|
||||||
- sendrawtransaction
|
- sendrawtransaction
|
||||||
- decoderawtransaction
|
- decoderawtransaction
|
||||||
- getrawtransaction
|
- getrawtransaction
|
||||||
|
@ -104,7 +104,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
inputs = [ {'txid' : "1d1d4e24ed99057e84c3f80fd8fbec79ed9e1acee37da269356ecea000000000", 'vout' : 1}] #won't exists
|
inputs = [ {'txid' : "1d1d4e24ed99057e84c3f80fd8fbec79ed9e1acee37da269356ecea000000000", 'vout' : 1}] #won't exists
|
||||||
outputs = { self.nodes[0].getnewaddress() : 4.998 }
|
outputs = { self.nodes[0].getnewaddress() : 4.998 }
|
||||||
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||||
rawtx = self.nodes[2].signrawtransaction(rawtx)
|
rawtx = self.nodes[2].signrawtransactionwithwallet(rawtx)
|
||||||
|
|
||||||
# This will raise an exception since there are missing inputs
|
# This will raise an exception since there are missing inputs
|
||||||
assert_raises_rpc_error(-25, "Missing inputs", self.nodes[2].sendrawtransaction, rawtx['hex'])
|
assert_raises_rpc_error(-25, "Missing inputs", self.nodes[2].sendrawtransaction, rawtx['hex'])
|
||||||
|
@ -202,10 +202,10 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
inputs = [{ "txid" : txId, "vout" : vout['n'], "scriptPubKey" : vout['scriptPubKey']['hex'], "amount" : vout['value']}]
|
inputs = [{ "txid" : txId, "vout" : vout['n'], "scriptPubKey" : vout['scriptPubKey']['hex'], "amount" : vout['value']}]
|
||||||
outputs = { self.nodes[0].getnewaddress() : 2.19 }
|
outputs = { self.nodes[0].getnewaddress() : 2.19 }
|
||||||
rawTx = self.nodes[2].createrawtransaction(inputs, outputs)
|
rawTx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||||
rawTxPartialSigned = self.nodes[1].signrawtransaction(rawTx, inputs)
|
rawTxPartialSigned = self.nodes[1].signrawtransactionwithwallet(rawTx, inputs)
|
||||||
assert_equal(rawTxPartialSigned['complete'], False) #node1 only has one key, can't comp. sign the tx
|
assert_equal(rawTxPartialSigned['complete'], False) #node1 only has one key, can't comp. sign the tx
|
||||||
|
|
||||||
rawTxSigned = self.nodes[2].signrawtransaction(rawTx, inputs)
|
rawTxSigned = self.nodes[2].signrawtransactionwithwallet(rawTx, inputs)
|
||||||
assert_equal(rawTxSigned['complete'], True) #node2 can sign the tx compl., own two of three keys
|
assert_equal(rawTxSigned['complete'], True) #node2 can sign the tx compl., own two of three keys
|
||||||
self.nodes[2].sendrawtransaction(rawTxSigned['hex'])
|
self.nodes[2].sendrawtransaction(rawTxSigned['hex'])
|
||||||
rawTx = self.nodes[0].decoderawtransaction(rawTxSigned['hex'])
|
rawTx = self.nodes[0].decoderawtransaction(rawTxSigned['hex'])
|
||||||
|
@ -247,11 +247,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
inputs = [{ "txid" : txId, "vout" : vout['n'], "scriptPubKey" : vout['scriptPubKey']['hex'], "redeemScript" : mSigObjValid['hex'], "amount" : vout['value']}]
|
inputs = [{ "txid" : txId, "vout" : vout['n'], "scriptPubKey" : vout['scriptPubKey']['hex'], "redeemScript" : mSigObjValid['hex'], "amount" : vout['value']}]
|
||||||
outputs = { self.nodes[0].getnewaddress() : 2.19 }
|
outputs = { self.nodes[0].getnewaddress() : 2.19 }
|
||||||
rawTx2 = self.nodes[2].createrawtransaction(inputs, outputs)
|
rawTx2 = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||||
rawTxPartialSigned1 = self.nodes[1].signrawtransaction(rawTx2, inputs)
|
rawTxPartialSigned1 = self.nodes[1].signrawtransactionwithwallet(rawTx2, inputs)
|
||||||
self.log.info(rawTxPartialSigned1)
|
self.log.info(rawTxPartialSigned1)
|
||||||
assert_equal(rawTxPartialSigned['complete'], False) #node1 only has one key, can't comp. sign the tx
|
assert_equal(rawTxPartialSigned['complete'], False) #node1 only has one key, can't comp. sign the tx
|
||||||
|
|
||||||
rawTxPartialSigned2 = self.nodes[2].signrawtransaction(rawTx2, inputs)
|
rawTxPartialSigned2 = self.nodes[2].signrawtransactionwithwallet(rawTx2, inputs)
|
||||||
self.log.info(rawTxPartialSigned2)
|
self.log.info(rawTxPartialSigned2)
|
||||||
assert_equal(rawTxPartialSigned2['complete'], False) #node2 only has one key, can't comp. sign the tx
|
assert_equal(rawTxPartialSigned2['complete'], False) #node2 only has one key, can't comp. sign the tx
|
||||||
rawTxComb = self.nodes[2].combinerawtransaction([rawTxPartialSigned1['hex'], rawTxPartialSigned2['hex']])
|
rawTxComb = self.nodes[2].combinerawtransaction([rawTxPartialSigned1['hex'], rawTxPartialSigned2['hex']])
|
||||||
|
|
|
@ -34,9 +34,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(): 49.99})
|
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].signrawtransactionwithwallet(tx1)["hex"])
|
||||||
tx2 = self.nodes[0].createrawtransaction([node0utxos.pop()], {self.nodes[1].getnewaddress(): 49.99})
|
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].signrawtransactionwithwallet(tx2)["hex"])
|
||||||
# This will raise an exception because the transaction is not yet in a block
|
# This will raise an exception because the transaction is not yet in a block
|
||||||
assert_raises_rpc_error(-5, "Transaction not yet in block", self.nodes[0].gettxoutproof, [txid1])
|
assert_raises_rpc_error(-5, "Transaction not yet in block", self.nodes[0].gettxoutproof, [txid1])
|
||||||
|
|
||||||
|
@ -55,7 +55,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(): 49.98})
|
tx3 = self.nodes[1].createrawtransaction([txin_spent], {self.nodes[0].getnewaddress(): 49.98})
|
||||||
txid3 = self.nodes[0].sendrawtransaction(self.nodes[1].signrawtransaction(tx3)["hex"])
|
txid3 = self.nodes[0].sendrawtransaction(self.nodes[1].signrawtransactionwithwallet(tx3)["hex"])
|
||||||
self.nodes[0].generate(1)
|
self.nodes[0].generate(1)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ def create_witness_tx(node, use_p2wsh, utxo, pubkey, encode_p2sh, amount):
|
||||||
def send_to_witness(use_p2wsh, node, utxo, pubkey, encode_p2sh, amount, sign=True, insert_redeem_script=""):
|
def send_to_witness(use_p2wsh, node, utxo, pubkey, encode_p2sh, amount, sign=True, insert_redeem_script=""):
|
||||||
tx_to_witness = create_witness_tx(node, use_p2wsh, utxo, pubkey, encode_p2sh, amount)
|
tx_to_witness = create_witness_tx(node, use_p2wsh, utxo, pubkey, encode_p2sh, amount)
|
||||||
if (sign):
|
if (sign):
|
||||||
signed = node.signrawtransaction(tx_to_witness)
|
signed = node.signrawtransactionwithwallet(tx_to_witness)
|
||||||
assert("errors" not in signed or len(["errors"]) == 0)
|
assert("errors" not in signed or len(["errors"]) == 0)
|
||||||
return node.sendrawtransaction(signed["hex"])
|
return node.sendrawtransaction(signed["hex"])
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -499,7 +499,7 @@ def create_confirmed_utxos(fee, node, count):
|
||||||
outputs[addr1] = satoshi_round(send_value / 2)
|
outputs[addr1] = satoshi_round(send_value / 2)
|
||||||
outputs[addr2] = satoshi_round(send_value / 2)
|
outputs[addr2] = satoshi_round(send_value / 2)
|
||||||
raw_tx = node.createrawtransaction(inputs, outputs)
|
raw_tx = node.createrawtransaction(inputs, outputs)
|
||||||
signed_tx = node.signrawtransaction(raw_tx)["hex"]
|
signed_tx = node.signrawtransactionwithwallet(raw_tx)["hex"]
|
||||||
node.sendrawtransaction(signed_tx)
|
node.sendrawtransaction(signed_tx)
|
||||||
|
|
||||||
while (node.getmempoolinfo()['size'] > 0):
|
while (node.getmempoolinfo()['size'] > 0):
|
||||||
|
@ -533,7 +533,7 @@ def create_tx(node, coinbase, to_address, amount):
|
||||||
inputs = [{"txid": coinbase, "vout": 0}]
|
inputs = [{"txid": coinbase, "vout": 0}]
|
||||||
outputs = {to_address: amount}
|
outputs = {to_address: amount}
|
||||||
rawtx = node.createrawtransaction(inputs, outputs)
|
rawtx = node.createrawtransaction(inputs, outputs)
|
||||||
signresult = node.signrawtransaction(rawtx)
|
signresult = node.signrawtransactionwithwallet(rawtx)
|
||||||
assert_equal(signresult["complete"], True)
|
assert_equal(signresult["complete"], True)
|
||||||
return signresult["hex"]
|
return signresult["hex"]
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||||
|
|
||||||
outputs[self.nodes[0].getnewaddress()] = Decimal("14.99998")
|
outputs[self.nodes[0].getnewaddress()] = Decimal("14.99998")
|
||||||
outputs[self.nodes[1].getnewaddress()] = Decimal("5")
|
outputs[self.nodes[1].getnewaddress()] = Decimal("5")
|
||||||
signed = self.nodes[0].signrawtransaction(self.nodes[0].createrawtransaction(inputs, outputs))
|
signed = self.nodes[0].signrawtransactionwithwallet(self.nodes[0].createrawtransaction(inputs, outputs))
|
||||||
txAB1 = self.nodes[0].sendrawtransaction(signed["hex"])
|
txAB1 = self.nodes[0].sendrawtransaction(signed["hex"])
|
||||||
|
|
||||||
# Identify the 14.99998btc output
|
# Identify the 14.99998btc output
|
||||||
|
@ -67,7 +67,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||||
inputs.append({"txid":txC, "vout":nC})
|
inputs.append({"txid":txC, "vout":nC})
|
||||||
outputs = {}
|
outputs = {}
|
||||||
outputs[self.nodes[0].getnewaddress()] = Decimal("24.9996")
|
outputs[self.nodes[0].getnewaddress()] = Decimal("24.9996")
|
||||||
signed2 = self.nodes[0].signrawtransaction(self.nodes[0].createrawtransaction(inputs, outputs))
|
signed2 = self.nodes[0].signrawtransactionwithwallet(self.nodes[0].createrawtransaction(inputs, outputs))
|
||||||
txABC2 = self.nodes[0].sendrawtransaction(signed2["hex"])
|
txABC2 = self.nodes[0].sendrawtransaction(signed2["hex"])
|
||||||
|
|
||||||
# In mempool txs from self should increase balance from change
|
# In mempool txs from self should increase balance from change
|
||||||
|
@ -138,7 +138,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||||
outputs = {}
|
outputs = {}
|
||||||
outputs[self.nodes[1].getnewaddress()] = Decimal("9.9999")
|
outputs[self.nodes[1].getnewaddress()] = Decimal("9.9999")
|
||||||
tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||||
signed = self.nodes[0].signrawtransaction(tx)
|
signed = self.nodes[0].signrawtransactionwithwallet(tx)
|
||||||
self.nodes[1].sendrawtransaction(signed["hex"])
|
self.nodes[1].sendrawtransaction(signed["hex"])
|
||||||
self.nodes[1].generate(1)
|
self.nodes[1].generate(1)
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ class WalletTest(BitcoinTestFramework):
|
||||||
inputs.append({ "txid" : utxo["txid"], "vout" : utxo["vout"]})
|
inputs.append({ "txid" : utxo["txid"], "vout" : utxo["vout"]})
|
||||||
outputs[self.nodes[2].getnewaddress("from1")] = utxo["amount"] - 3
|
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].signrawtransactionwithwallet(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)
|
||||||
|
@ -225,7 +225,7 @@ class WalletTest(BitcoinTestFramework):
|
||||||
|
|
||||||
rawTx = self.nodes[1].createrawtransaction(inputs, outputs).replace("c0833842", "00000000") #replace 11.11 with 0.0 (int32)
|
rawTx = self.nodes[1].createrawtransaction(inputs, outputs).replace("c0833842", "00000000") #replace 11.11 with 0.0 (int32)
|
||||||
decRawTx = self.nodes[1].decoderawtransaction(rawTx)
|
decRawTx = self.nodes[1].decoderawtransaction(rawTx)
|
||||||
signedRawTx = self.nodes[1].signrawtransaction(rawTx)
|
signedRawTx = self.nodes[1].signrawtransactionwithwallet(rawTx)
|
||||||
decRawTx = self.nodes[1].decoderawtransaction(signedRawTx['hex'])
|
decRawTx = self.nodes[1].decoderawtransaction(signedRawTx['hex'])
|
||||||
zeroValueTxid= decRawTx['txid']
|
zeroValueTxid= decRawTx['txid']
|
||||||
self.nodes[1].sendrawtransaction(signedRawTx['hex'])
|
self.nodes[1].sendrawtransaction(signedRawTx['hex'])
|
||||||
|
@ -400,7 +400,7 @@ class WalletTest(BitcoinTestFramework):
|
||||||
node0_balance = self.nodes[0].getbalance()
|
node0_balance = self.nodes[0].getbalance()
|
||||||
# Split into two chains
|
# Split into two chains
|
||||||
rawtx = self.nodes[0].createrawtransaction([{"txid":singletxid, "vout":0}], {chain_addrs[0]:node0_balance/2-Decimal('0.01'), chain_addrs[1]:node0_balance/2-Decimal('0.01')})
|
rawtx = self.nodes[0].createrawtransaction([{"txid":singletxid, "vout":0}], {chain_addrs[0]:node0_balance/2-Decimal('0.01'), chain_addrs[1]:node0_balance/2-Decimal('0.01')})
|
||||||
signedtx = self.nodes[0].signrawtransaction(rawtx)
|
signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx)
|
||||||
singletxid = self.nodes[0].sendrawtransaction(signedtx["hex"])
|
singletxid = self.nodes[0].sendrawtransaction(signedtx["hex"])
|
||||||
self.nodes[0].generate(1)
|
self.nodes[0].generate(1)
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ def test_segwit_bumpfee_succeeds(rbf_node, dest_address):
|
||||||
"sequence": BIP125_SEQUENCE_NUMBER
|
"sequence": BIP125_SEQUENCE_NUMBER
|
||||||
}], {dest_address: Decimal("0.0005"),
|
}], {dest_address: Decimal("0.0005"),
|
||||||
rbf_node.getrawchangeaddress(): Decimal("0.0003")})
|
rbf_node.getrawchangeaddress(): Decimal("0.0003")})
|
||||||
rbfsigned = rbf_node.signrawtransaction(rbfraw)
|
rbfsigned = rbf_node.signrawtransactionwithwallet(rbfraw)
|
||||||
rbfid = rbf_node.sendrawtransaction(rbfsigned["hex"])
|
rbfid = rbf_node.sendrawtransaction(rbfsigned["hex"])
|
||||||
assert rbfid in rbf_node.getrawmempool()
|
assert rbfid in rbf_node.getrawmempool()
|
||||||
|
|
||||||
|
@ -150,8 +150,8 @@ def test_notmine_bumpfee_fails(rbf_node, peer_node, dest_address):
|
||||||
} for utxo in utxos]
|
} for utxo in utxos]
|
||||||
output_val = sum(utxo["amount"] for utxo in utxos) - Decimal("0.001")
|
output_val = sum(utxo["amount"] for utxo in utxos) - Decimal("0.001")
|
||||||
rawtx = rbf_node.createrawtransaction(inputs, {dest_address: output_val})
|
rawtx = rbf_node.createrawtransaction(inputs, {dest_address: output_val})
|
||||||
signedtx = rbf_node.signrawtransaction(rawtx)
|
signedtx = rbf_node.signrawtransactionwithwallet(rawtx)
|
||||||
signedtx = peer_node.signrawtransaction(signedtx["hex"])
|
signedtx = peer_node.signrawtransactionwithwallet(signedtx["hex"])
|
||||||
rbfid = rbf_node.sendrawtransaction(signedtx["hex"])
|
rbfid = rbf_node.sendrawtransaction(signedtx["hex"])
|
||||||
assert_raises_rpc_error(-4, "Transaction contains inputs that don't belong to this wallet",
|
assert_raises_rpc_error(-4, "Transaction contains inputs that don't belong to this wallet",
|
||||||
rbf_node.bumpfee, rbfid)
|
rbf_node.bumpfee, rbfid)
|
||||||
|
@ -162,7 +162,7 @@ def test_bumpfee_with_descendant_fails(rbf_node, rbf_node_address, dest_address)
|
||||||
# parent is send-to-self, so we don't have to check which output is change when creating the child tx
|
# parent is send-to-self, so we don't have to check which output is change when creating the child tx
|
||||||
parent_id = spend_one_input(rbf_node, rbf_node_address)
|
parent_id = spend_one_input(rbf_node, rbf_node_address)
|
||||||
tx = rbf_node.createrawtransaction([{"txid": parent_id, "vout": 0}], {dest_address: 0.00020000})
|
tx = rbf_node.createrawtransaction([{"txid": parent_id, "vout": 0}], {dest_address: 0.00020000})
|
||||||
tx = rbf_node.signrawtransaction(tx)
|
tx = rbf_node.signrawtransactionwithwallet(tx)
|
||||||
rbf_node.sendrawtransaction(tx["hex"])
|
rbf_node.sendrawtransaction(tx["hex"])
|
||||||
assert_raises_rpc_error(-8, "Transaction has descendants in the wallet", rbf_node.bumpfee, parent_id)
|
assert_raises_rpc_error(-8, "Transaction has descendants in the wallet", rbf_node.bumpfee, parent_id)
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ def spend_one_input(node, dest_address):
|
||||||
rawtx = node.createrawtransaction(
|
rawtx = node.createrawtransaction(
|
||||||
[tx_input], {dest_address: Decimal("0.00050000"),
|
[tx_input], {dest_address: Decimal("0.00050000"),
|
||||||
node.getrawchangeaddress(): Decimal("0.00049000")})
|
node.getrawchangeaddress(): Decimal("0.00049000")})
|
||||||
signedtx = node.signrawtransaction(rawtx)
|
signedtx = node.signrawtransactionwithwallet(rawtx)
|
||||||
txid = node.sendrawtransaction(signedtx["hex"])
|
txid = node.sendrawtransaction(signedtx["hex"])
|
||||||
return txid
|
return txid
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ class ListSinceBlockTest (BitcoinTestFramework):
|
||||||
'vout': utxo['vout'],
|
'vout': utxo['vout'],
|
||||||
}]
|
}]
|
||||||
txid1 = self.nodes[1].sendrawtransaction(
|
txid1 = self.nodes[1].sendrawtransaction(
|
||||||
self.nodes[1].signrawtransaction(
|
self.nodes[1].signrawtransactionwithwallet(
|
||||||
self.nodes[1].createrawtransaction(utxoDicts, recipientDict))['hex'])
|
self.nodes[1].createrawtransaction(utxoDicts, recipientDict))['hex'])
|
||||||
|
|
||||||
# send from nodes[2] using utxo to nodes[3]
|
# send from nodes[2] using utxo to nodes[3]
|
||||||
|
@ -167,7 +167,7 @@ class ListSinceBlockTest (BitcoinTestFramework):
|
||||||
self.nodes[2].getnewaddress(): change,
|
self.nodes[2].getnewaddress(): change,
|
||||||
}
|
}
|
||||||
self.nodes[2].sendrawtransaction(
|
self.nodes[2].sendrawtransaction(
|
||||||
self.nodes[2].signrawtransaction(
|
self.nodes[2].signrawtransactionwithwallet(
|
||||||
self.nodes[2].createrawtransaction(utxoDicts, recipientDict2))['hex'])
|
self.nodes[2].createrawtransaction(utxoDicts, recipientDict2))['hex'])
|
||||||
|
|
||||||
# generate on both sides
|
# generate on both sides
|
||||||
|
@ -232,7 +232,7 @@ class ListSinceBlockTest (BitcoinTestFramework):
|
||||||
'txid': utxo['txid'],
|
'txid': utxo['txid'],
|
||||||
'vout': utxo['vout'],
|
'vout': utxo['vout'],
|
||||||
}]
|
}]
|
||||||
signedtxres = self.nodes[2].signrawtransaction(
|
signedtxres = self.nodes[2].signrawtransactionwithwallet(
|
||||||
self.nodes[2].createrawtransaction(utxoDicts, recipientDict))
|
self.nodes[2].createrawtransaction(utxoDicts, recipientDict))
|
||||||
assert signedtxres['complete']
|
assert signedtxres['complete']
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ class TxnMallTest(BitcoinTestFramework):
|
||||||
outputs[node1_address] = 1240
|
outputs[node1_address] = 1240
|
||||||
outputs[change_address] = 1248 - 1240 + doublespend_fee
|
outputs[change_address] = 1248 - 1240 + doublespend_fee
|
||||||
rawtx = self.nodes[0].createrawtransaction(inputs, outputs)
|
rawtx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||||
doublespend = self.nodes[0].signrawtransaction(rawtx)
|
doublespend = self.nodes[0].signrawtransactionwithwallet(rawtx)
|
||||||
assert_equal(doublespend["complete"], True)
|
assert_equal(doublespend["complete"], True)
|
||||||
|
|
||||||
# Create two spends using 1 50 BTC coin each
|
# Create two spends using 1 50 BTC coin each
|
||||||
|
|
Loading…
Reference in a new issue