electrum

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

commit 97e849a248c6415e1032090ebb01b999c6fff1d4
parent 5a4576344ed35bf062652477f18ff79b9c27e969
Author: ecdsa <ecdsa@github>
Date:   Wed,  1 May 2013 10:40:44 +0200

move verify_message to wallet

Diffstat:
Mgui/gui_classic.py | 8+++-----
Mlib/commands.py | 7+------
Mlib/wallet.py | 7+++++++
3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/gui/gui_classic.py b/gui/gui_classic.py @@ -1465,12 +1465,10 @@ class ElectrumWindow(QMainWindow): layout.setRowStretch(3,1) def do_verify(): - try: - self.wallet.verify_message(verify_address.text(), str(verify_signature.toPlainText()), str(verify_message.toPlainText())) + if self.wallet.verify_message(verify_address.text(), str(verify_signature.toPlainText()), str(verify_message.toPlainText())): self.show_message(_("Signature verified")) - except BaseException, e: - self.show_message(str(e)) - return + else: + self.show_message(_("Error: wrong signature")) hbox = QHBoxLayout() b = QPushButton(_("Verify")) diff --git a/lib/commands.py b/lib/commands.py @@ -203,12 +203,7 @@ class Commands: def verifymessage(self, address, signature, message): - try: - EC_KEY.verify_message(address, signature, message) - return True - except BaseException as e: - print_error("Verification error: {0}".format(e)) - return False + return self.wallet.verify_message(address, signature, message) def _mktx(self, to_address, amount, fee = None, change_addr = None, domain = None): diff --git a/lib/wallet.py b/lib/wallet.py @@ -292,6 +292,13 @@ class Wallet: compressed = is_compressed(sec) return key.sign_message(message, compressed, address) + def verify_message(self, address, signature, message): + try: + EC_KEY.verify_message(address, signature, message) + return True + except BaseException as e: + print_error("Verification error: {0}".format(e)) + return False def create_new_address(self, account, for_change): addresses = self.accounts[account][for_change]