mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-30 02:31:05 +02:00
[Tests] Rename create_tx and move to blocktools.py
This commit is contained in:
@ -128,6 +128,19 @@ def create_transaction(prevtx, n, sig, value, script_pub_key=CScript()):
|
||||
tx.calc_sha256()
|
||||
return tx
|
||||
|
||||
def create_raw_transaction(node, txid, to_address, amount):
|
||||
""" Return raw signed transaction spending the first output of 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
|
||||
multiple wallets.
|
||||
"""
|
||||
inputs = [{"txid": txid, "vout": 0}]
|
||||
outputs = {to_address: amount}
|
||||
rawtx = node.createrawtransaction(inputs, outputs)
|
||||
signresult = node.signrawtransactionwithwallet(rawtx)
|
||||
assert_equal(signresult["complete"], True)
|
||||
return signresult['hex']
|
||||
|
||||
def get_legacy_sigopcount_block(block, accurate=True):
|
||||
count = 0
|
||||
for tx in block.vtx:
|
||||
|
Reference in New Issue
Block a user