From be58549fd9fe53df237a7318f754b5ec23975425 Mon Sep 17 00:00:00 2001 From: Tibor Arpas Date: Fri, 19 Oct 2018 17:59:33 +0200 Subject: [PATCH] src/apps/wallet/sign_tx: handle timestamp field --- src/apps/wallet/sign_tx/helpers.py | 2 ++ src/apps/wallet/sign_tx/signing.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/apps/wallet/sign_tx/helpers.py b/src/apps/wallet/sign_tx/helpers.py index 837721ea0d..d60a5967b5 100644 --- a/src/apps/wallet/sign_tx/helpers.py +++ b/src/apps/wallet/sign_tx/helpers.py @@ -122,6 +122,7 @@ def sanitize_sign_tx(tx: SignTx) -> SignTx: tx.coin_name = tx.coin_name if tx.coin_name is not None else "Bitcoin" tx.expiry = tx.expiry if tx.expiry is not None else 0 tx.overwintered = tx.overwintered if tx.overwintered is not None else False + tx.timestamp = tx.timestamp if tx.timestamp is not None else 0 return tx @@ -133,6 +134,7 @@ def sanitize_tx_meta(tx: TransactionType) -> TransactionType: tx.extra_data_len = tx.extra_data_len if tx.extra_data_len is not None else 0 tx.expiry = tx.expiry if tx.expiry is not None else 0 tx.overwintered = tx.overwintered if tx.overwintered is not None else False + tx.timestamp = tx.timestamp if tx.timestamp is not None else 0 return tx diff --git a/src/apps/wallet/sign_tx/signing.py b/src/apps/wallet/sign_tx/signing.py index b2a8d43f82..36654f6c7d 100644 --- a/src/apps/wallet/sign_tx/signing.py +++ b/src/apps/wallet/sign_tx/signing.py @@ -391,6 +391,8 @@ async def sign_tx(tx: SignTx, root: bip32.HDNode): write_uint32(h_sign, tx.version_group_id) # nVersionGroupId else: write_uint32(h_sign, tx.version) # nVersion + if tx.timestamp: + write_uint32(h_sign, tx.timestamp) write_varint(h_sign, tx.inputs_count) @@ -586,6 +588,8 @@ async def get_prevtx_output_value( write_uint32(txh, tx.version | DECRED_SERIALIZE_NO_WITNESS) else: write_uint32(txh, tx.version) # nVersion + if tx.timestamp: + write_uint32(txh, tx.timestamp) write_varint(txh, tx.inputs_cnt) @@ -653,6 +657,8 @@ def get_tx_header(coin: CoinInfo, tx: SignTx, segwit: bool = False): write_uint32(w_txi, tx.version_group_id) # nVersionGroupId else: write_uint32(w_txi, tx.version) # nVersion + if tx.timestamp: + write_uint32(w_txi, tx.timestamp) if segwit: write_varint(w_txi, 0x00) # segwit witness marker write_varint(w_txi, 0x01) # segwit witness flag