MCPcopy Create free account
hub / github.com/ElementsProject/elements / create_raw_chain

Function create_raw_chain

test/functional/test_framework/wallet.py:298–314  ·  view source on GitHub ↗

Helper function: create a "chain" of chain_length transactions. The nth transaction in the chain is a child of the n-1th transaction and parent of the n+1th transaction.

(node, first_coin, address, privkeys, chain_length=25)

Source from the content-addressed store, hash-verified

296 return signedtx_child["hex"]
297
298def create_raw_chain(node, first_coin, address, privkeys, chain_length=25):
299 """Helper function: create a "chain" of chain_length transactions. The nth transaction in the
300 chain is a child of the n-1th transaction and parent of the n+1th transaction.
301 """
302 parent_locking_script = None
303 txid = first_coin["txid"]
304 chain_hex = []
305 chain_txns = []
306 value = first_coin["amount"]
307
308 for _ in range(chain_length):
309 (tx, txhex, value, parent_locking_script) = make_chain(node, address, privkeys, txid, value, 0, parent_locking_script)
310 txid = tx.rehash()
311 chain_hex.append(txhex)
312 chain_txns.append(tx)
313
314 return (chain_hex, chain_txns)
315
316def bulk_transaction(tx, node, target_weight, privkeys, prevtxs=None):
317 """Pad a transaction with extra outputs until it reaches a target weight (or higher).

Callers 1

test_chainMethod · 0.90

Calls 2

make_chainFunction · 0.85
rehashMethod · 0.45

Tested by 1

test_chainMethod · 0.72