1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-22 05:10:56 +00:00

Don't require prevtx for coins with BIP-143 fork id (#352)

Coins like Bitcoin Cash and Bitcoin Gold always use BIP-143 signatures
that do not require previous transactions.
This commit is contained in:
Jochen Hoenicke 2019-01-07 12:57:12 +01:00 committed by matejcik
parent 369b704f6b
commit 0428f5091c

View File

@ -14,7 +14,7 @@
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
from . import messages
from . import coins, messages
from .tools import CallException, expect, normalize_nfc, session
@ -91,6 +91,11 @@ def sign_tx(client, coin_name, inputs, outputs, details=None, prev_txes=None):
# set up a transactions dict
txes = {None: messages.TransactionType(inputs=inputs, outputs=outputs)}
# preload all relevant transactions ahead of time
if coin_name in coins.by_name:
load_prevtxes = not coins.by_name[coin_name]["force_bip143"]
else:
load_prevtxes = True
if load_prevtxes:
for inp in inputs:
if inp.script_type not in (
messages.InputScriptType.SPENDP2SHWITNESS,