src/apps/wallet/sign_tx: small fixes to decred

pull/25/head
Pavol Rusnak 6 years ago
parent 6bced8bb54
commit 335504ce5c
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -144,6 +144,7 @@ async def check_tx_fee(tx: SignTx, root: bip32.HDNode):
raise SigningError(FailureType.ActionCancelled, "Output cancelled")
if coin.decred:
txo.decred_script_version = txo.decred_script_version or 0
if txo.decred_script_version != 0:
raise SigningError(
FailureType.ActionCancelled,
@ -398,7 +399,7 @@ async def sign_tx(tx: SignTx, root: bip32.HDNode):
# STAGE_REQUEST_5_OUTPUT
txo = await request_tx_output(tx_req, o)
txo_bin.amount = txo.amount
txo_bin.decred_script_version = txo.decred_script_version
txo_bin.decred_script_version = txo.decred_script_version or 0
txo_bin.script_pubkey = output_derive_script(txo, coin, root)
# serialize output
@ -585,6 +586,7 @@ async def get_prevtx_output_value(
for o in range(tx.outputs_cnt):
# STAGE_REQUEST_2_PREV_OUTPUT
txo_bin = await request_tx_output(tx_req, o, prev_hash)
txo_bin.decred_script_version = txo_bin.decred_script_version or 0
write_tx_output(txh, txo_bin)
if o == prev_index:
total_out += txo_bin.amount

@ -37,8 +37,8 @@ def write_tx_input_check(w, i: TxInputType):
def write_tx_input_decred(w, i: TxInputType):
write_bytes_reversed(w, i.prev_hash)
write_uint32(w, i.prev_index)
write_uint8(w, i.decred_tree)
write_uint32(w, i.prev_index or 0)
write_uint8(w, i.decred_tree or 0)
write_uint32(w, i.sequence)

Loading…
Cancel
Save