Browse Source

move verify_message to wallet

283
ecdsa 12 years ago
parent
commit
97e849a248
  1. 8
      gui/gui_classic.py
  2. 7
      lib/commands.py
  3. 7
      lib/wallet.py

8
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"))

7
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):

7
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]

Loading…
Cancel
Save