1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-25 09:22:33 +00:00

feat(legacy): Skip external input witnesses when serialization is disabled.

This commit is contained in:
Andrew Kozlik 2022-12-21 18:50:31 +01:00 committed by matejcik
parent ec9756cabd
commit b4d681ea1c

View File

@ -686,6 +686,38 @@ void phase1_request_orig_input(void) {
} }
} }
void phase2_request_next_witness(bool first) {
if (first) {
idx1 = 0;
if (!to.is_segwit) {
send_req_finished();
signing_abort();
return;
}
} else if (idx1 < info.inputs_count - 1) {
idx1++;
} else {
send_req_finished();
signing_abort();
return;
}
if (!serialize) {
// Skip external inputs when serialization is disabled.
while (is_external_input(idx1)) {
if (idx1 >= info.inputs_count - 1) {
send_req_finished();
signing_abort();
return;
}
idx1++;
}
}
send_req_segwit_witness();
return;
}
void phase2_request_next_output(bool first) { void phase2_request_next_output(bool first) {
if (first) { if (first) {
if (serialize) { if (serialize) {
@ -700,13 +732,7 @@ void phase2_request_next_output(bool first) {
} }
// Output serialization is finished. Generate witnesses. // Output serialization is finished. Generate witnesses.
if (to.is_segwit) { phase2_request_next_witness(true);
idx1 = 0;
send_req_segwit_witness();
} else {
send_req_finished();
signing_abort();
}
} }
void phase2_request_next_input(bool first) { void phase2_request_next_input(bool first) {
@ -3528,13 +3554,7 @@ void signing_txack(TransactionType *tx) {
progress = 500 + ((signatures * progress_step) >> PROGRESS_PRECISION); progress = 500 + ((signatures * progress_step) >> PROGRESS_PRECISION);
layoutProgress(_("Signing transaction"), progress); layoutProgress(_("Signing transaction"), progress);
update_ctr = 0; update_ctr = 0;
if (idx1 < info.inputs_count - 1) { phase2_request_next_witness(false);
idx1++;
send_req_segwit_witness();
} else {
send_req_finished();
signing_abort();
}
return; return;
#if !BITCOIN_ONLY #if !BITCOIN_ONLY