Merge #13928: qa: blocktools enforce named args for amount
cf9ed307e6
qa: blocktools enforce named args for amount (MarcoFalke)
Pull request description:
Since #13669 changed some signatures, I think it might be worthwhile to enforce named args for primitive types such as amounts.
Tree-SHA512: 2733e7b6a20590b54bd54e81a09e3f5e2fadf4390bed594916b70729bcf485b048266012c1203369e0968032a2c6a2719107ac17ee925d8939af3df916eab1a6
This commit is contained in:
commit
b8eb0dfde4
8 changed files with 37 additions and 41 deletions
|
@ -65,7 +65,7 @@ class BIP65Test(BitcoinTestFramework):
|
||||||
self.log.info("Test that an invalid-according-to-CLTV transaction can still appear in a block")
|
self.log.info("Test that an invalid-according-to-CLTV transaction can still appear in a block")
|
||||||
|
|
||||||
spendtx = create_transaction(self.nodes[0], self.coinbase_txids[0],
|
spendtx = create_transaction(self.nodes[0], self.coinbase_txids[0],
|
||||||
self.nodeaddress, 1.0)
|
self.nodeaddress, amount=1.0)
|
||||||
cltv_invalidate(spendtx)
|
cltv_invalidate(spendtx)
|
||||||
spendtx.rehash()
|
spendtx.rehash()
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ class BIP65Test(BitcoinTestFramework):
|
||||||
block.nVersion = 4
|
block.nVersion = 4
|
||||||
|
|
||||||
spendtx = create_transaction(self.nodes[0], self.coinbase_txids[1],
|
spendtx = create_transaction(self.nodes[0], self.coinbase_txids[1],
|
||||||
self.nodeaddress, 1.0)
|
self.nodeaddress, amount=1.0)
|
||||||
cltv_invalidate(spendtx)
|
cltv_invalidate(spendtx)
|
||||||
spendtx.rehash()
|
spendtx.rehash()
|
||||||
|
|
||||||
|
|
|
@ -94,15 +94,14 @@ def sign_transaction(node, unsignedtx):
|
||||||
return tx
|
return tx
|
||||||
|
|
||||||
def create_bip112special(node, input, txversion, address):
|
def create_bip112special(node, input, txversion, address):
|
||||||
tx = create_transaction(node, input, address, Decimal("49.98"))
|
tx = create_transaction(node, input, address, amount=Decimal("49.98"))
|
||||||
tx.nVersion = txversion
|
tx.nVersion = txversion
|
||||||
signtx = sign_transaction(node, tx)
|
signtx = sign_transaction(node, tx)
|
||||||
signtx.vin[0].scriptSig = CScript([-1, OP_CHECKSEQUENCEVERIFY, OP_DROP] + list(CScript(signtx.vin[0].scriptSig)))
|
signtx.vin[0].scriptSig = CScript([-1, OP_CHECKSEQUENCEVERIFY, OP_DROP] + list(CScript(signtx.vin[0].scriptSig)))
|
||||||
return signtx
|
return signtx
|
||||||
|
|
||||||
def send_generic_input_tx(node, coinbases, address):
|
def send_generic_input_tx(node, coinbases, address):
|
||||||
amount = Decimal("49.99")
|
return node.sendrawtransaction(ToHex(sign_transaction(node, create_transaction(node, node.getblock(coinbases.pop())['tx'][0], address, amount=Decimal("49.99")))))
|
||||||
return node.sendrawtransaction(ToHex(sign_transaction(node, create_transaction(node, node.getblock(coinbases.pop())['tx'][0], address, amount))))
|
|
||||||
|
|
||||||
def create_bip68txs(node, bip68inputs, txversion, address, locktime_delta=0):
|
def create_bip68txs(node, bip68inputs, txversion, address, locktime_delta=0):
|
||||||
"""Returns a list of bip68 transactions with different bits set."""
|
"""Returns a list of bip68 transactions with different bits set."""
|
||||||
|
@ -110,7 +109,7 @@ def create_bip68txs(node, bip68inputs, txversion, address, locktime_delta=0):
|
||||||
assert(len(bip68inputs) >= 16)
|
assert(len(bip68inputs) >= 16)
|
||||||
for i, (sdf, srhb, stf, srlb) in enumerate(product(*[[True, False]] * 4)):
|
for i, (sdf, srhb, stf, srlb) in enumerate(product(*[[True, False]] * 4)):
|
||||||
locktime = relative_locktime(sdf, srhb, stf, srlb)
|
locktime = relative_locktime(sdf, srhb, stf, srlb)
|
||||||
tx = create_transaction(node, bip68inputs[i], address, Decimal("49.98"))
|
tx = create_transaction(node, bip68inputs[i], address, amount=Decimal("49.98"))
|
||||||
tx.nVersion = txversion
|
tx.nVersion = txversion
|
||||||
tx.vin[0].nSequence = locktime + locktime_delta
|
tx.vin[0].nSequence = locktime + locktime_delta
|
||||||
tx = sign_transaction(node, tx)
|
tx = sign_transaction(node, tx)
|
||||||
|
@ -125,7 +124,7 @@ def create_bip112txs(node, bip112inputs, varyOP_CSV, txversion, address, locktim
|
||||||
assert(len(bip112inputs) >= 16)
|
assert(len(bip112inputs) >= 16)
|
||||||
for i, (sdf, srhb, stf, srlb) in enumerate(product(*[[True, False]] * 4)):
|
for i, (sdf, srhb, stf, srlb) in enumerate(product(*[[True, False]] * 4)):
|
||||||
locktime = relative_locktime(sdf, srhb, stf, srlb)
|
locktime = relative_locktime(sdf, srhb, stf, srlb)
|
||||||
tx = create_transaction(node, bip112inputs[i], address, Decimal("49.98"))
|
tx = create_transaction(node, bip112inputs[i], address, amount=Decimal("49.98"))
|
||||||
if (varyOP_CSV): # if varying OP_CSV, nSequence is fixed
|
if (varyOP_CSV): # if varying OP_CSV, nSequence is fixed
|
||||||
tx.vin[0].nSequence = BASE_RELATIVE_LOCKTIME + locktime_delta
|
tx.vin[0].nSequence = BASE_RELATIVE_LOCKTIME + locktime_delta
|
||||||
else: # vary nSequence instead, OP_CSV is fixed
|
else: # vary nSequence instead, OP_CSV is fixed
|
||||||
|
@ -269,10 +268,10 @@ class BIP68_112_113Test(BitcoinTestFramework):
|
||||||
|
|
||||||
# Test both version 1 and version 2 transactions for all tests
|
# Test both version 1 and version 2 transactions for all tests
|
||||||
# BIP113 test transaction will be modified before each use to put in appropriate block time
|
# BIP113 test transaction will be modified before each use to put in appropriate block time
|
||||||
bip113tx_v1 = create_transaction(self.nodes[0], bip113input, self.nodeaddress, Decimal("49.98"))
|
bip113tx_v1 = create_transaction(self.nodes[0], bip113input, self.nodeaddress, amount=Decimal("49.98"))
|
||||||
bip113tx_v1.vin[0].nSequence = 0xFFFFFFFE
|
bip113tx_v1.vin[0].nSequence = 0xFFFFFFFE
|
||||||
bip113tx_v1.nVersion = 1
|
bip113tx_v1.nVersion = 1
|
||||||
bip113tx_v2 = create_transaction(self.nodes[0], bip113input, self.nodeaddress, Decimal("49.98"))
|
bip113tx_v2 = create_transaction(self.nodes[0], bip113input, self.nodeaddress, amount=Decimal("49.98"))
|
||||||
bip113tx_v2.vin[0].nSequence = 0xFFFFFFFE
|
bip113tx_v2.vin[0].nSequence = 0xFFFFFFFE
|
||||||
bip113tx_v2.nVersion = 2
|
bip113tx_v2.nVersion = 2
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ class BIP66Test(BitcoinTestFramework):
|
||||||
self.log.info("Test that a transaction with non-DER signature can still appear in a block")
|
self.log.info("Test that a transaction with non-DER signature can still appear in a block")
|
||||||
|
|
||||||
spendtx = create_transaction(self.nodes[0], self.coinbase_txids[0],
|
spendtx = create_transaction(self.nodes[0], self.coinbase_txids[0],
|
||||||
self.nodeaddress, 1.0)
|
self.nodeaddress, amount=1.0)
|
||||||
unDERify(spendtx)
|
unDERify(spendtx)
|
||||||
spendtx.rehash()
|
spendtx.rehash()
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class BIP66Test(BitcoinTestFramework):
|
||||||
block.nVersion = 3
|
block.nVersion = 3
|
||||||
|
|
||||||
spendtx = create_transaction(self.nodes[0], self.coinbase_txids[1],
|
spendtx = create_transaction(self.nodes[0], self.coinbase_txids[1],
|
||||||
self.nodeaddress, 1.0)
|
self.nodeaddress, amount=1.0)
|
||||||
unDERify(spendtx)
|
unDERify(spendtx)
|
||||||
spendtx.rehash()
|
spendtx.rehash()
|
||||||
|
|
||||||
|
@ -127,8 +127,7 @@ class BIP66Test(BitcoinTestFramework):
|
||||||
assert b'Non-canonical DER signature' in self.nodes[0].p2p.last_message["reject"].reason
|
assert b'Non-canonical DER signature' in self.nodes[0].p2p.last_message["reject"].reason
|
||||||
|
|
||||||
self.log.info("Test that a version 3 block with a DERSIG-compliant transaction is accepted")
|
self.log.info("Test that a version 3 block with a DERSIG-compliant transaction is accepted")
|
||||||
block.vtx[1] = create_transaction(self.nodes[0],
|
block.vtx[1] = create_transaction(self.nodes[0], self.coinbase_txids[1], self.nodeaddress, amount=1.0)
|
||||||
self.coinbase_txids[1], self.nodeaddress, 1.0)
|
|
||||||
block.hashMerkleRoot = block.calc_merkle_root()
|
block.hashMerkleRoot = block.calc_merkle_root()
|
||||||
block.rehash()
|
block.rehash()
|
||||||
block.solve()
|
block.solve()
|
||||||
|
|
|
@ -60,16 +60,16 @@ class NULLDUMMYTest(BitcoinTestFramework):
|
||||||
self.lastblocktime = int(time.time()) + 429
|
self.lastblocktime = int(time.time()) + 429
|
||||||
|
|
||||||
self.log.info("Test 1: NULLDUMMY compliant base transactions should be accepted to mempool and mined before activation [430]")
|
self.log.info("Test 1: NULLDUMMY compliant base transactions should be accepted to mempool and mined before activation [430]")
|
||||||
test1txs = [create_transaction(self.nodes[0], coinbase_txid[0], self.ms_address, 49)]
|
test1txs = [create_transaction(self.nodes[0], coinbase_txid[0], self.ms_address, amount=49)]
|
||||||
txid1 = self.nodes[0].sendrawtransaction(bytes_to_hex_str(test1txs[0].serialize_with_witness()), True)
|
txid1 = self.nodes[0].sendrawtransaction(bytes_to_hex_str(test1txs[0].serialize_with_witness()), True)
|
||||||
test1txs.append(create_transaction(self.nodes[0], txid1, self.ms_address, 48))
|
test1txs.append(create_transaction(self.nodes[0], txid1, self.ms_address, amount=48))
|
||||||
txid2 = self.nodes[0].sendrawtransaction(bytes_to_hex_str(test1txs[1].serialize_with_witness()), True)
|
txid2 = self.nodes[0].sendrawtransaction(bytes_to_hex_str(test1txs[1].serialize_with_witness()), True)
|
||||||
test1txs.append(create_transaction(self.nodes[0], coinbase_txid[1], self.wit_ms_address, 49))
|
test1txs.append(create_transaction(self.nodes[0], coinbase_txid[1], self.wit_ms_address, amount=49))
|
||||||
txid3 = self.nodes[0].sendrawtransaction(bytes_to_hex_str(test1txs[2].serialize_with_witness()), True)
|
txid3 = self.nodes[0].sendrawtransaction(bytes_to_hex_str(test1txs[2].serialize_with_witness()), True)
|
||||||
self.block_submit(self.nodes[0], test1txs, False, True)
|
self.block_submit(self.nodes[0], test1txs, False, True)
|
||||||
|
|
||||||
self.log.info("Test 2: Non-NULLDUMMY base multisig transaction should not be accepted to mempool before activation")
|
self.log.info("Test 2: Non-NULLDUMMY base multisig transaction should not be accepted to mempool before activation")
|
||||||
test2tx = create_transaction(self.nodes[0], txid2, self.ms_address, 47)
|
test2tx = create_transaction(self.nodes[0], txid2, self.ms_address, amount=47)
|
||||||
trueDummy(test2tx)
|
trueDummy(test2tx)
|
||||||
assert_raises_rpc_error(-26, NULLDUMMY_ERROR, self.nodes[0].sendrawtransaction, bytes_to_hex_str(test2tx.serialize_with_witness()), True)
|
assert_raises_rpc_error(-26, NULLDUMMY_ERROR, self.nodes[0].sendrawtransaction, bytes_to_hex_str(test2tx.serialize_with_witness()), True)
|
||||||
|
|
||||||
|
@ -77,14 +77,14 @@ class NULLDUMMYTest(BitcoinTestFramework):
|
||||||
self.block_submit(self.nodes[0], [test2tx], False, True)
|
self.block_submit(self.nodes[0], [test2tx], False, True)
|
||||||
|
|
||||||
self.log.info("Test 4: Non-NULLDUMMY base multisig transaction is invalid after activation")
|
self.log.info("Test 4: Non-NULLDUMMY base multisig transaction is invalid after activation")
|
||||||
test4tx = create_transaction(self.nodes[0], test2tx.hash, self.address, 46)
|
test4tx = create_transaction(self.nodes[0], test2tx.hash, self.address, amount=46)
|
||||||
test6txs=[CTransaction(test4tx)]
|
test6txs=[CTransaction(test4tx)]
|
||||||
trueDummy(test4tx)
|
trueDummy(test4tx)
|
||||||
assert_raises_rpc_error(-26, NULLDUMMY_ERROR, self.nodes[0].sendrawtransaction, bytes_to_hex_str(test4tx.serialize_with_witness()), True)
|
assert_raises_rpc_error(-26, NULLDUMMY_ERROR, self.nodes[0].sendrawtransaction, bytes_to_hex_str(test4tx.serialize_with_witness()), True)
|
||||||
self.block_submit(self.nodes[0], [test4tx])
|
self.block_submit(self.nodes[0], [test4tx])
|
||||||
|
|
||||||
self.log.info("Test 5: Non-NULLDUMMY P2WSH multisig transaction invalid after activation")
|
self.log.info("Test 5: Non-NULLDUMMY P2WSH multisig transaction invalid after activation")
|
||||||
test5tx = create_transaction(self.nodes[0], txid3, self.wit_address, 48)
|
test5tx = create_transaction(self.nodes[0], txid3, self.wit_address, amount=48)
|
||||||
test6txs.append(CTransaction(test5tx))
|
test6txs.append(CTransaction(test5tx))
|
||||||
test5tx.wit.vtxinwit[0].scriptWitness.stack[0] = b'\x01'
|
test5tx.wit.vtxinwit[0].scriptWitness.stack[0] = b'\x01'
|
||||||
assert_raises_rpc_error(-26, NULLDUMMY_ERROR, self.nodes[0].sendrawtransaction, bytes_to_hex_str(test5tx.serialize_with_witness()), True)
|
assert_raises_rpc_error(-26, NULLDUMMY_ERROR, self.nodes[0].sendrawtransaction, bytes_to_hex_str(test5tx.serialize_with_witness()), True)
|
||||||
|
|
|
@ -39,9 +39,9 @@ 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 = create_raw_transaction(self.nodes[0], coinbase_txids[1], node1_address, 49.99)
|
spend_101_raw = create_raw_transaction(self.nodes[0], coinbase_txids[1], node1_address, amount=49.99)
|
||||||
spend_102_raw = create_raw_transaction(self.nodes[0], coinbase_txids[2], node0_address, 49.99)
|
spend_102_raw = create_raw_transaction(self.nodes[0], coinbase_txids[2], node0_address, amount=49.99)
|
||||||
spend_103_raw = create_raw_transaction(self.nodes[0], coinbase_txids[3], node0_address, 49.99)
|
spend_103_raw = create_raw_transaction(self.nodes[0], coinbase_txids[3], node0_address, amount=49.99)
|
||||||
|
|
||||||
# Create a transaction which is time-locked to two blocks in the future
|
# Create a transaction which is time-locked to two blocks in the future
|
||||||
timelock_tx = self.nodes[0].createrawtransaction([{"txid": coinbase_txids[0], "vout": 0}], {node0_address: 49.99})
|
timelock_tx = self.nodes[0].createrawtransaction([{"txid": coinbase_txids[0], "vout": 0}], {node0_address: 49.99})
|
||||||
|
@ -57,11 +57,11 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||||
spend_103_id = self.nodes[0].sendrawtransaction(spend_103_raw)
|
spend_103_id = self.nodes[0].sendrawtransaction(spend_103_raw)
|
||||||
self.nodes[0].generate(1)
|
self.nodes[0].generate(1)
|
||||||
# Time-locked transaction is still too immature to spend
|
# Time-locked transaction is still 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)
|
||||||
|
|
||||||
# Create 102_1 and 103_1:
|
# Create 102_1 and 103_1:
|
||||||
spend_102_1_raw = create_raw_transaction(self.nodes[0], spend_102_id, node1_address, 49.98)
|
spend_102_1_raw = create_raw_transaction(self.nodes[0], spend_102_id, node1_address, amount=49.98)
|
||||||
spend_103_1_raw = create_raw_transaction(self.nodes[0], spend_103_id, node1_address, 49.98)
|
spend_103_1_raw = create_raw_transaction(self.nodes[0], spend_103_id, node1_address, amount=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)
|
||||||
|
|
|
@ -25,16 +25,16 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||||
# Mine a new block
|
# Mine a new block
|
||||||
# ... make sure all the transactions are confirmed again.
|
# ... make sure all the transactions are confirmed again.
|
||||||
|
|
||||||
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_raw_transaction(self.nodes[0], txid, node0_address, 49.99) for txid in coinbase_txids ]
|
spends1_raw = [create_raw_transaction(self.nodes[0], txid, node0_address, amount=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 = [ create_raw_transaction(self.nodes[0], txid, node0_address, 49.98) for txid in spends1_id ]
|
spends2_raw = [create_raw_transaction(self.nodes[0], txid, node0_address, amount=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))
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,9 @@ class MempoolSpendCoinbaseTest(BitcoinTestFramework):
|
||||||
# Coinbase at height chain_height-100+1 ok in mempool, should
|
# Coinbase at height chain_height-100+1 ok in mempool, should
|
||||||
# get mined. Coinbase at height chain_height-100+2 is
|
# get mined. Coinbase at height chain_height-100+2 is
|
||||||
# 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 = [ create_raw_transaction(self.nodes[0], txid, node0_address, 49.99) for txid in coinbase_txids ]
|
spends_raw = [create_raw_transaction(self.nodes[0], txid, node0_address, amount=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])
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ def create_coinbase(height, pubkey=None):
|
||||||
coinbase.calc_sha256()
|
coinbase.calc_sha256()
|
||||||
return coinbase
|
return coinbase
|
||||||
|
|
||||||
def create_tx_with_script(prevtx, n, script_sig=b"", amount=1, script_pub_key=CScript()):
|
def create_tx_with_script(prevtx, n, script_sig=b"", *, amount, script_pub_key=CScript()):
|
||||||
"""Return one-input, one-output transaction object
|
"""Return one-input, one-output transaction object
|
||||||
spending the prevtx's n-th output with the given amount.
|
spending the prevtx's n-th output with the given amount.
|
||||||
|
|
||||||
|
@ -131,26 +131,24 @@ def create_tx_with_script(prevtx, n, script_sig=b"", amount=1, script_pub_key=CS
|
||||||
tx.calc_sha256()
|
tx.calc_sha256()
|
||||||
return tx
|
return tx
|
||||||
|
|
||||||
def create_transaction(node, txid, to_address, amount):
|
def create_transaction(node, txid, to_address, *, amount):
|
||||||
""" Return signed transaction spending the first output of the
|
""" Return signed transaction spending the first output of the
|
||||||
input txid. Note that the node must be able to sign for the
|
input txid. Note that the node must be able to sign for the
|
||||||
output that is being spent, and the node must not be running
|
output that is being spent, and the node must not be running
|
||||||
multiple wallets.
|
multiple wallets.
|
||||||
"""
|
"""
|
||||||
raw_tx = create_raw_transaction(node, txid, to_address, amount)
|
raw_tx = create_raw_transaction(node, txid, to_address, amount=amount)
|
||||||
tx = CTransaction()
|
tx = CTransaction()
|
||||||
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx)))
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx)))
|
||||||
return tx
|
return tx
|
||||||
|
|
||||||
def create_raw_transaction(node, txid, to_address, amount):
|
def create_raw_transaction(node, txid, to_address, *, amount):
|
||||||
""" Return raw signed transaction spending the first output of the
|
""" Return raw signed transaction spending the first output of the
|
||||||
input txid. Note that the node must be able to sign for the
|
input txid. Note that the node must be able to sign for the
|
||||||
output that is being spent, and the node must not be running
|
output that is being spent, and the node must not be running
|
||||||
multiple wallets.
|
multiple wallets.
|
||||||
"""
|
"""
|
||||||
inputs = [{"txid": txid, "vout": 0}]
|
rawtx = node.createrawtransaction(inputs=[{"txid": txid, "vout": 0}], outputs={to_address: amount})
|
||||||
outputs = {to_address: amount}
|
|
||||||
rawtx = node.createrawtransaction(inputs, outputs)
|
|
||||||
signresult = node.signrawtransactionwithwallet(rawtx)
|
signresult = node.signrawtransactionwithwallet(rawtx)
|
||||||
assert_equal(signresult["complete"], True)
|
assert_equal(signresult["complete"], True)
|
||||||
return signresult['hex']
|
return signresult['hex']
|
||||||
|
|
Loading…
Reference in a new issue