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

Function create_tx_with_script

test/functional/test_framework/blocktools.py:205–217  ·  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 output.

(prevtx, n, script_sig=b"", *, amount, output_script=None)

Source from the content-addressed store, hash-verified

203 return coinbase
204
205def create_tx_with_script(prevtx, n, script_sig=b"", *, amount, output_script=None):
206 """Return one-input, one-output transaction object
207 spending the prevtx's n-th output with the given amount.
208
209 Can optionally pass scriptPubKey and scriptSig, default is anyone-can-spend output.
210 """
211 if output_script is None:
212 output_script = CScript()
213 tx = CTransaction()
214 assert n < len(prevtx.vout)
215 tx.vin.append(CTxIn(COutPoint(prevtx.txid_int, n), script_sig, SEQUENCE_FINAL))
216 tx.vout.append(CTxOut(amount, output_script))
217 return tx
218
219def get_legacy_sigopcount_block(block, accurate=True):
220 count = 0

Callers 12

run_testMethod · 0.90
run_testMethod · 0.90
_test_getblockMethod · 0.90
create_txMethod · 0.90
get_txMethod · 0.90
get_txMethod · 0.90
get_txMethod · 0.90
get_txMethod · 0.90
get_txMethod · 0.90
get_txMethod · 0.90
get_txMethod · 0.90
get_txMethod · 0.90

Calls 5

CScriptClass · 0.70
CTransactionClass · 0.70
CTxInClass · 0.70
COutPointClass · 0.70
CTxOutClass · 0.70

Tested by

no test coverage detected