Browse Source

Fix multiple trustedcoin bugs.

283
Neil Booth 9 years ago
parent
commit
b1704ce911
  1. 35
      plugins/trustedcoin/qt.py
  2. 13
      plugins/trustedcoin/trustedcoin.py

35
plugins/trustedcoin/qt.py

@ -1,4 +1,23 @@
#!/usr/bin/env python
#
# Electrum - Lightweight Bitcoin Client
# Copyright (C) 2015 Thomas Voegtlin
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from functools import partial
from threading import Thread
from PyQt4.QtGui import *
from PyQt4.QtCore import *
@ -10,7 +29,19 @@ from electrum_gui.qt.main_window import StatusBarButton
from electrum.i18n import _
from electrum.plugins import hook
from trustedcoin import TrustedCoinPlugin
from trustedcoin import TrustedCoinPlugin, Wallet_2fa
def need_server(wallet, tx):
from electrum.account import BIP32_Account
# Detect if the server is needed
long_id, short_id = wallet.get_user_id()
xpub3 = wallet.master_public_keys['x3/']
for x in tx.inputs_to_sign():
if x[0:2] == 'ff':
xpub, sequence = BIP32_Account.parse_xpubkey(x)
if xpub == xpub3:
return True
return False
class Plugin(TrustedCoinPlugin):
@ -240,5 +271,3 @@ class Plugin(TrustedCoinPlugin):
except:
QMessageBox.information(window, _('Message'), _('Incorrect password'), _('OK'))
pw.setText('')

13
plugins/trustedcoin/trustedcoin.py

@ -16,7 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from threading import Thread
import socket
import os
import re
@ -270,18 +269,6 @@ def make_billing_address(wallet, num):
address = public_key_to_bc_address( cK )
return address
def need_server(wallet, tx):
from electrum.account import BIP32_Account
# Detect if the server is needed
long_id, short_id = wallet.get_user_id()
xpub3 = wallet.master_public_keys['x3/']
for x in tx.inputs_to_sign():
if x[0:2] == 'ff':
xpub, sequence = BIP32_Account.parse_xpubkey(x)
if xpub == xpub3:
return True
return False
class TrustedCoinPlugin(BasePlugin):

Loading…
Cancel
Save