electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 81d641a13f9bad6585090a424b4ed726b9258188
parent d5c3c09bbcec490c9a6f6bb4e33ffe0214c051c6
Author: Neil Booth <kyuupichan@gmail.com>
Date:   Sun, 10 Jan 2016 14:53:00 +0900

Show BIP32 path for BIP32_HD_Wallet classes

from right-click Show Public Keys menu.

Fixes #1598

Diffstat:
Mgui/qt/main_window.py | 9++++++---
Mlib/wallet.py | 23++++++++++++-----------
2 files changed, 18 insertions(+), 14 deletions(-)

diff --git 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 @@ -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 ''))