From ee352bcee0cfc44d0976914f3eaf498caf2ddfd6 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 17 Oct 2017 22:16:46 +0200 Subject: [PATCH] maintenance for greenaddress plugin --- plugins/greenaddress_instant/qt.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/greenaddress_instant/qt.py b/plugins/greenaddress_instant/qt.py index 12e8e524..93d2bb71 100644 --- a/plugins/greenaddress_instant/qt.py +++ b/plugins/greenaddress_instant/qt.py @@ -24,7 +24,7 @@ # SOFTWARE. import base64 -import urllib +import urllib.parse import sys import requests @@ -67,7 +67,7 @@ class Plugin(BasePlugin): window = d.parent # 1. get the password and sign the verification request password = None - if wallet.use_encryption: + if wallet.has_password(): msg = _('GreenAddress requires your signature \n' 'to verify that transaction is instant.\n' 'Please enter your password to sign a\n' @@ -80,20 +80,20 @@ class Plugin(BasePlugin): QApplication.processEvents() # update the button label addr = self.get_my_addr(d) - message = "Please verify if %s is GreenAddress instant confirmed" % tx.hash() + message = "Please verify if %s is GreenAddress instant confirmed" % tx.txid() sig = wallet.sign_message(addr, message, password) - sig = base64.b64encode(sig) + sig = base64.b64encode(sig).decode('ascii') # 2. send the request - response = requests.request("GET", ("https://greenaddress.it/verify/?signature=%s&txhash=%s" % (urllib.quote(sig), tx.hash())), + response = requests.request("GET", ("https://greenaddress.it/verify/?signature=%s&txhash=%s" % (urllib.parse.quote(sig), tx.txid())), headers = {'User-Agent': 'Electrum'}) response = response.json() # 3. display the result if response.get('verified'): - d.show_message(_('%s is covered by GreenAddress instant confirmation') % (tx.hash()), title=_('Verification successful!')) + d.show_message(_('%s is covered by GreenAddress instant confirmation') % (tx.txid()), title=_('Verification successful!')) else: - d.show_critical(_('%s is not covered by GreenAddress instant confirmation') % (tx.hash()), title=_('Verification failed!')) + d.show_critical(_('%s is not covered by GreenAddress instant confirmation') % (tx.txid()), title=_('Verification failed!')) except BaseException as e: import traceback traceback.print_exc(file=sys.stdout)