mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-02 02:41:28 +00:00
sign_tx: add rbf opt-in enable, add locktime, add tx version
This commit is contained in:
parent
79da872316
commit
4962207703
@ -505,13 +505,16 @@ def sign_tx(connect, coin):
|
|||||||
prev_hash, prev_index = prev
|
prev_hash, prev_index = prev
|
||||||
address_n = click.prompt('BIP-32 path to derive the key', type=client.expand_path)
|
address_n = click.prompt('BIP-32 path to derive the key', type=client.expand_path)
|
||||||
amount = click.prompt('Input amount (satoshis)', type=int, default=0)
|
amount = click.prompt('Input amount (satoshis)', type=int, default=0)
|
||||||
|
sequence = click.prompt('Sequence Number to use (RBF opt-in enabled by default)', type=int, default=0xfffffffd)
|
||||||
script_type = click.prompt('Input type', type=CHOICE_INPUT_SCRIPT_TYPE, default=default_script_type(address_n))
|
script_type = click.prompt('Input type', type=CHOICE_INPUT_SCRIPT_TYPE, default=default_script_type(address_n))
|
||||||
|
script_type = script_type if isinstance(script_type, int) else CHOICE_INPUT_SCRIPT_TYPE.typemap[script_type]
|
||||||
inputs.append(proto.TxInputType(
|
inputs.append(proto.TxInputType(
|
||||||
address_n=address_n,
|
address_n=address_n,
|
||||||
prev_hash=prev_hash,
|
prev_hash=prev_hash,
|
||||||
prev_index=prev_index,
|
prev_index=prev_index,
|
||||||
amount=amount,
|
amount=amount,
|
||||||
script_type=script_type,
|
script_type=script_type,
|
||||||
|
sequence=sequence,
|
||||||
))
|
))
|
||||||
|
|
||||||
outputs = []
|
outputs = []
|
||||||
@ -526,6 +529,7 @@ def sign_tx(connect, coin):
|
|||||||
break
|
break
|
||||||
amount = click.prompt('Amount to spend (satoshis)', type=int)
|
amount = click.prompt('Amount to spend (satoshis)', type=int)
|
||||||
script_type = click.prompt('Output type', type=CHOICE_OUTPUT_SCRIPT_TYPE, default=default_script_type(address_n))
|
script_type = click.prompt('Output type', type=CHOICE_OUTPUT_SCRIPT_TYPE, default=default_script_type(address_n))
|
||||||
|
script_type = script_type if isinstance(script_type, int) else CHOICE_OUTPUT_SCRIPT_TYPE.typemap[script_type]
|
||||||
outputs.append(proto.TxOutputType(
|
outputs.append(proto.TxOutputType(
|
||||||
address_n=address_n,
|
address_n=address_n,
|
||||||
address=address,
|
address=address,
|
||||||
@ -533,7 +537,10 @@ def sign_tx(connect, coin):
|
|||||||
script_type=script_type,
|
script_type=script_type,
|
||||||
))
|
))
|
||||||
|
|
||||||
(signatures, serialized_tx) = client.sign_tx(coin, inputs, outputs)
|
tx_version = click.prompt('Transaction version', type=int, default=2)
|
||||||
|
tx_locktime = click.prompt('Transaction locktime', type=int, default=0)
|
||||||
|
|
||||||
|
(signatures, serialized_tx) = client.sign_tx(coin, inputs, outputs, tx_version, tx_locktime)
|
||||||
|
|
||||||
client.close()
|
client.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user