diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index 13986179..f14d766a 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -42,8 +42,8 @@ from electrum.util import format_satoshis, format_satoshis_plain, format_time from electrum.util import PrintError, NotEnoughFunds, StoreDict from electrum import Transaction, mnemonic from electrum import util, bitcoin, commands -from electrum import SimpleConfig, COIN_CHOOSERS -from electrum import Wallet, paymentrequest +from electrum import SimpleConfig, COIN_CHOOSERS, paymentrequest +from electrum.wallet import Wallet, BIP32_HD_Wallet from amountedit import BTCAmountEdit, MyLineEdit, BTCkBEdit from network_dialog import NetworkDialog @@ -2030,7 +2030,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): d.setMinimumSize(600, 200) vbox = QVBoxLayout() vbox.addWidget( QLabel(_("Address") + ': ' + address)) - vbox.addWidget( QLabel(_("Public key") + ':')) + if isinstance(self.wallet, BIP32_HD_Wallet): + derivation = self.wallet.address_id(address) + vbox.addWidget(QLabel(_("Derivation") + ': ' + derivation)) + vbox.addWidget(QLabel(_("Public key") + ':')) keys_e = ShowQRTextEdit(text='\n'.join(pubkey_list)) keys_e.addCopyButton(self.app) vbox.addWidget(keys_e) diff --git a/lib/wallet.py b/lib/wallet.py index 1c42199e..a7929c1b 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -1725,17 +1725,6 @@ class BIP32_HD_Wallet(BIP32_Wallet): def accounts_all_used(self): return all(self.account_is_used(acc_id) for acc_id in self.accounts) -class BIP44_Wallet(BIP32_HD_Wallet): - root_derivation = "m/44'/0'" - wallet_type = 'bip44' - - def can_sign_xpubkey(self, x_pubkey): - xpub, sequence = BIP32_Account.parse_xpubkey(x_pubkey) - return xpub in self.master_public_keys.values() - - def can_create_accounts(self): - return not self.is_watching_only() - @classmethod def prefix(self): return "/".join(self.root_derivation.split("/")[1:]) @@ -1753,6 +1742,18 @@ class BIP44_Wallet(BIP32_HD_Wallet): acc_id, (change, address_index) = self.get_address_index(address) return self.address_derivation(acc_id, change, address_index) + +class BIP44_Wallet(BIP32_HD_Wallet): + root_derivation = "m/44'/0'" + wallet_type = 'bip44' + + def can_sign_xpubkey(self, x_pubkey): + xpub, sequence = BIP32_Account.parse_xpubkey(x_pubkey) + return xpub in self.master_public_keys.values() + + def can_create_accounts(self): + return not self.is_watching_only() + @staticmethod def normalize_passphrase(passphrase): return normalize('NFKD', unicode(passphrase or ''))