bugfix: assert walrus (":=") combo side-eff. breaks w/ asserts disabled
``` $ python3 -O Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> assert (x := 2) >>> x Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'x' is not defined ``` pity. it looked to be a neat and concise pattern.
This commit is contained in:
@@ -444,7 +444,8 @@ class BitBox02Client(HardwareClientBase):
|
||||
}
|
||||
)
|
||||
|
||||
assert (desc := txin.script_descriptor)
|
||||
desc = txin.script_descriptor
|
||||
assert desc
|
||||
if tx_script_type is None:
|
||||
tx_script_type = desc.to_legacy_electrum_script_type()
|
||||
elif tx_script_type != desc.to_legacy_electrum_script_type():
|
||||
|
||||
@@ -528,7 +528,8 @@ class DigitalBitbox_KeyStore(Hardware_KeyStore):
|
||||
if txin.is_coinbase_input():
|
||||
self.give_error("Coinbase not supported") # should never happen
|
||||
|
||||
assert (desc := txin.script_descriptor)
|
||||
desc = txin.script_descriptor
|
||||
assert desc
|
||||
if desc.to_legacy_electrum_script_type() != 'p2pkh':
|
||||
p2pkhTransaction = False
|
||||
|
||||
|
||||
@@ -280,7 +280,8 @@ class Jade_KeyStore(Hardware_KeyStore):
|
||||
change = [None] * len(tx.outputs())
|
||||
for index, txout in enumerate(tx.outputs()):
|
||||
if txout.is_mine and txout.is_change:
|
||||
assert (desc := txout.script_descriptor)
|
||||
desc = txout.script_descriptor
|
||||
assert desc
|
||||
if is_multisig:
|
||||
# Multisig - wallet details must be registered on Jade hw
|
||||
multisig_name = _register_multisig_wallet(wallet, self, txout.address)
|
||||
|
||||
@@ -371,7 +371,8 @@ class KeepKeyPlugin(HW_PluginBase):
|
||||
assert isinstance(tx, PartialTransaction)
|
||||
assert isinstance(txin, PartialTxInput)
|
||||
assert keystore
|
||||
assert (desc := txin.script_descriptor)
|
||||
desc = txin.script_descriptor
|
||||
assert desc
|
||||
if multi := desc.get_simple_multisig():
|
||||
multisig = self._make_multisig(multi)
|
||||
else:
|
||||
@@ -417,7 +418,8 @@ class KeepKeyPlugin(HW_PluginBase):
|
||||
def tx_outputs(self, tx: PartialTransaction, *, keystore: 'KeepKey_KeyStore'):
|
||||
|
||||
def create_output_by_derivation():
|
||||
assert (desc := txout.script_descriptor)
|
||||
desc = txout.script_descriptor
|
||||
assert desc
|
||||
script_type = self.get_keepkey_output_script_type(desc.to_legacy_electrum_script_type())
|
||||
if multi := desc.get_simple_multisig():
|
||||
multisig = self._make_multisig(multi)
|
||||
|
||||
@@ -341,7 +341,8 @@ class SafeTPlugin(HW_PluginBase):
|
||||
assert isinstance(tx, PartialTransaction)
|
||||
assert isinstance(txin, PartialTxInput)
|
||||
assert keystore
|
||||
assert (desc := txin.script_descriptor)
|
||||
desc = txin.script_descriptor
|
||||
assert desc
|
||||
if multi := desc.get_simple_multisig():
|
||||
multisig = self._make_multisig(multi)
|
||||
else:
|
||||
@@ -387,7 +388,8 @@ class SafeTPlugin(HW_PluginBase):
|
||||
def tx_outputs(self, tx: PartialTransaction, *, keystore: 'SafeTKeyStore'):
|
||||
|
||||
def create_output_by_derivation():
|
||||
assert (desc := txout.script_descriptor)
|
||||
desc = txout.script_descriptor
|
||||
assert desc
|
||||
script_type = self.get_safet_output_script_type(desc.to_legacy_electrum_script_type())
|
||||
if multi := desc.get_simple_multisig():
|
||||
multisig = self._make_multisig(multi)
|
||||
|
||||
@@ -412,7 +412,8 @@ class TrezorPlugin(HW_PluginBase):
|
||||
assert isinstance(tx, PartialTransaction)
|
||||
assert isinstance(txin, PartialTxInput)
|
||||
assert keystore
|
||||
assert (desc := txin.script_descriptor)
|
||||
desc = txin.script_descriptor
|
||||
assert desc
|
||||
if multi := desc.get_simple_multisig():
|
||||
txinputtype.multisig = self._make_multisig(multi)
|
||||
txinputtype.script_type = self.get_trezor_input_script_type(desc.to_legacy_electrum_script_type())
|
||||
@@ -444,7 +445,8 @@ class TrezorPlugin(HW_PluginBase):
|
||||
def tx_outputs(self, tx: PartialTransaction, *, keystore: 'TrezorKeyStore'):
|
||||
|
||||
def create_output_by_derivation():
|
||||
assert (desc := txout.script_descriptor)
|
||||
desc = txout.script_descriptor
|
||||
assert desc
|
||||
script_type = self.get_trezor_output_script_type(desc.to_legacy_electrum_script_type())
|
||||
if multi := desc.get_simple_multisig():
|
||||
multisig = self._make_multisig(multi)
|
||||
|
||||
Reference in New Issue
Block a user