MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / create_tx_with_script

Function create_tx_with_script

test/functional/test_framework/blocktools.py:121–132  ·  view source on GitHub ↗

Return one-input, one-output transaction object spending the prevtx's n-th output with the given amount. Can optionally pass scriptPubKey and scriptSig, default is anyone-can-spend ouput.

(prevtx, n, script_sig=b"", *, amount, script_pub_key=CScript())

Source from the content-addressed store, hash-verified

119 return coinbase
120
121def create_tx_with_script(prevtx, n, script_sig=b"", *, amount, script_pub_key=CScript()):
122 """Return one-input, one-output transaction object
123 spending the prevtx's n-th output with the given amount.
124
125 Can optionally pass scriptPubKey and scriptSig, default is anyone-can-spend ouput.
126 """
127 tx = CTransaction()
128 assert(n < len(prevtx.vout))
129 tx.vin.append(CTxIn(COutPoint(prevtx.sha256, n), script_sig, 0xffffffff))
130 tx.vout.append(CTxOut(amount, script_pub_key))
131 tx.calc_sha256()
132 return tx
133
134def create_transaction(node, txid, to_address, *, amount):
135 """ Return signed transaction spending the first output of the

Callers 4

run_testMethod · 0.90
run_testMethod · 0.90
run_testMethod · 0.90
create_txMethod · 0.90

Calls 6

calc_sha256Method · 0.95
CScriptClass · 0.70
CTransactionClass · 0.70
CTxInClass · 0.70
COutPointClass · 0.70
CTxOutClass · 0.70

Tested by

no test coverage detected