From f1801764a15c2631087ab4203af78fed047dcb25 Mon Sep 17 00:00:00 2001 From: Andrew Kozlik Date: Thu, 9 Apr 2020 14:35:56 +0200 Subject: [PATCH] core/sign_tx: Fix segwit/non-segwit input interleaving bug. --- core/src/apps/wallet/sign_tx/signing.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/src/apps/wallet/sign_tx/signing.py b/core/src/apps/wallet/sign_tx/signing.py index 10744ba55..4445c1056 100644 --- a/core/src/apps/wallet/sign_tx/signing.py +++ b/core/src/apps/wallet/sign_tx/signing.py @@ -181,12 +181,8 @@ class Bitcoin: if self.segwit[i]: await self.sign_segwit_input(i) elif any_segwit: - # TODO what if a non-segwit input follows after a segwit input? - self.tx_ser.serialized_tx += bytearray( - 1 - ) # empty witness for non-segwit inputs - self.tx_ser.signature_index = None - self.tx_ser.signature = None + # add empty witness for non-segwit inputs + self.tx_ser.serialized_tx.append(0) self.tx_req.serialized = self.tx_ser async def step7_finish(self) -> None: