trezor / python-trezor

:snake: Don't use this repo, use the new monorepo instead:
https://github.com/trezor/trezor-firmware
GNU Lesser General Public License v3.0
201 stars 194 forks source link

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

Closed jhoenicke closed 5 years ago

jhoenicke commented 5 years ago

Is using coins.by_name okay here, to check for force_bip143?

This is necessary to get electron-cash working again (plus the obvious update of the plugin in electroncash – I'm working on that).

matejcik commented 5 years ago

it's ok, but please modify it so that it doesn't crash if the coin_name is unknown.

something like:

if coin_name in coins.by_name:
    load_prevtxes = coins.by_name[coin_name]["force_bip143"]
else:
    load_prevtxes = False

also note that you could work around this by providing prev_txes=defaultdict(TransactionType) on the one hand i'm sort of reluctant to recommend it :)) on the other, i'm considering adding this as a constant to btc.py, perhaps IGNORE_PREV_TXES as a special value for this purpose?

jhoenicke commented 5 years ago

I added the if coin_name in coins.by_name you suggested, just fixed the polarity (load_prevtxes is true if force_bip143 is false).

I also added the defaultdict workaround to electroncash so that it works with trezor 0.11.1.

matejcik commented 5 years ago

merged, thanks!