1
0

Qt tx dialog: warn if user asked for full bip32 paths but info missing

related: https://github.com/spesmilo/electrum/issues/5969#issuecomment-591441399

Instead of a log line, maybe it should warn as part of the GUI.. but this is a start.
This commit is contained in:
SomberNight
2020-02-27 03:31:14 +01:00
parent 22861b70ee
commit bea038ea6b

View File

@@ -266,6 +266,14 @@ class BaseTxDialog(QDialog, MessageBoxMixin):
raise Exception("Can only export partial transactions for hardware device.")
tx = copy.deepcopy(self.tx)
tx.add_info_from_wallet(self.wallet, include_xpubs_and_full_paths=True)
# log warning if PSBT_*_BIP32_DERIVATION fields cannot be filled with full path due to missing info
from electrum.keystore import Xpub
def is_ks_missing_info(ks):
return (isinstance(ks, Xpub) and (ks.get_root_fingerprint() is None
or ks.get_derivation_prefix() is None))
if any([is_ks_missing_info(ks) for ks in self.wallet.get_keystores()]):
_logger.warning('PSBT was requested to be filled with full bip32 paths but '
'some keystores lacked either the derivation prefix or the root fingerprint')
return tx
def copy_to_clipboard(self, *, tx: Transaction = None):