timprove payreq signing message - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 7588519e8eb62fbd72f997a6550fc91194aaf5ef DIR parent 677f235e4ba71b3efb0e2497f3005257b49b1d20 HTML Author: ThomasV <thomasv@gitorious> Date: Tue, 14 Jul 2015 16:03:42 +0200 improve payreq signing message Diffstat: M gui/qt/main_window.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) --- DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py t@@ -730,7 +730,22 @@ class ElectrumWindow(QMainWindow): i = self.expires_combo.currentIndex() expiration = map(lambda x: x[1], expiration_values)[i] req = self.wallet.make_payment_request(addr, amount, message, expiration) - pr, requestor = self.make_bip70_request(req) + alias = self.config.get('alias') + alias_privkey = None + if alias and self.alias_info: + alias_addr, alias_name, validated = self.alias_info + if alias_addr: + if self.wallet.is_mine(alias_addr): + msg = _('This payment request will be signed.') + '\n' + _('Please enter your password') + password = self.password_dialog(msg) + if password: + alias_privkey = self.wallet.get_private_key(alias_addr, password)[0] + else: + return + else: + if not self.question(_('This request will not be signed; the Bitcoin address returned by your alias does not belong to your wallet')): + return + pr, requestor = paymentrequest.make_request(self.config, req, alias, alias_privkey) if requestor: req['requestor'] = requestor req['signature'] = pr.signature.encode('hex') t@@ -740,16 +755,6 @@ class ElectrumWindow(QMainWindow): self.save_request_button.setEnabled(False) return pr - def make_bip70_request(self, req): - alias_privkey = None - alias = self.config.get('alias') - if alias and self.alias_info: - alias_addr, alias_name, validated = self.alias_info - if alias_addr and self.wallet.is_mine(alias_addr): - password = self.password_dialog(_('Please enter your password in order to sign your payment request.')) - if password: - alias_privkey = self.wallet.get_private_key(alias_addr, password)[0] - return paymentrequest.make_request(self.config, req, alias, alias_privkey) def export_payment_request(self, addr): r = self.wallet.receive_requests.get(addr)