mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-14 03:30:02 +00:00
fix prevtx hashing when input count is 0
This commit is contained in:
parent
2daab8cf02
commit
e9f0706c2e
@ -334,7 +334,12 @@ void signing_txack(TransactionType *tx)
|
|||||||
tx_init(&tp, tx->inputs_cnt, tx->outputs_cnt, tx->version, tx->lock_time, tx->extra_data_len, false);
|
tx_init(&tp, tx->inputs_cnt, tx->outputs_cnt, tx->version, tx->lock_time, tx->extra_data_len, false);
|
||||||
progress_meta_step = progress_step / (tp.inputs_len + tp.outputs_len);
|
progress_meta_step = progress_step / (tp.inputs_len + tp.outputs_len);
|
||||||
idx2 = 0;
|
idx2 = 0;
|
||||||
send_req_2_prev_input();
|
if (tp.inputs_len > 0) {
|
||||||
|
send_req_2_prev_input();
|
||||||
|
} else {
|
||||||
|
tx_serialize_header_hash(&tp);
|
||||||
|
send_req_2_prev_output();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
case STAGE_REQUEST_2_PREV_INPUT:
|
case STAGE_REQUEST_2_PREV_INPUT:
|
||||||
progress = (idx1 * progress_step + idx2 * progress_meta_step) >> PROGRESS_PRECISION;
|
progress = (idx1 * progress_step + idx2 * progress_meta_step) >> PROGRESS_PRECISION;
|
||||||
|
@ -55,6 +55,7 @@ uint32_t tx_serialize_input(TxStruct *tx, const TxInputType *input, uint8_t *out
|
|||||||
uint32_t tx_serialize_output(TxStruct *tx, const TxOutputBinType *output, uint8_t *out);
|
uint32_t tx_serialize_output(TxStruct *tx, const TxOutputBinType *output, uint8_t *out);
|
||||||
|
|
||||||
void tx_init(TxStruct *tx, uint32_t inputs_len, uint32_t outputs_len, uint32_t version, uint32_t lock_time, uint32_t extra_data_len, bool add_hash_type);
|
void tx_init(TxStruct *tx, uint32_t inputs_len, uint32_t outputs_len, uint32_t version, uint32_t lock_time, uint32_t extra_data_len, bool add_hash_type);
|
||||||
|
uint32_t tx_serialize_header_hash(TxStruct *tx);
|
||||||
uint32_t tx_serialize_input_hash(TxStruct *tx, const TxInputType *input);
|
uint32_t tx_serialize_input_hash(TxStruct *tx, const TxInputType *input);
|
||||||
uint32_t tx_serialize_output_hash(TxStruct *tx, const TxOutputBinType *output);
|
uint32_t tx_serialize_output_hash(TxStruct *tx, const TxOutputBinType *output);
|
||||||
uint32_t tx_serialize_extra_data_hash(TxStruct *tx, const uint8_t *data, uint32_t datalen);
|
uint32_t tx_serialize_extra_data_hash(TxStruct *tx, const uint8_t *data, uint32_t datalen);
|
||||||
|
Loading…
Reference in New Issue
Block a user