more trustedcoin fixes
This commit is contained in:
parent
2baf8e2079
commit
36c90502ae
|
@ -37,20 +37,8 @@ from electrum_gui.qt.amountedit import AmountEdit
|
|||
from electrum_gui.qt.main_window import StatusBarButton
|
||||
from electrum.i18n import _
|
||||
from electrum.plugins import hook
|
||||
|
||||
from trustedcoin import TrustedCoinPlugin, server
|
||||
|
||||
def need_server(wallet, tx):
|
||||
from electrum.keystore import parse_xpubkey, is_xpubkey
|
||||
# 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 is_xpubkey(x):
|
||||
xpub, sequence = parse_xpubkey(x)
|
||||
if xpub == xpub3:
|
||||
return True
|
||||
return False
|
||||
|
||||
class Plugin(TrustedCoinPlugin):
|
||||
|
||||
|
@ -98,7 +86,7 @@ class Plugin(TrustedCoinPlugin):
|
|||
if not wallet.can_sign_without_server():
|
||||
self.print_error("twofactor:sign_tx")
|
||||
auth_code = None
|
||||
if need_server(wallet, tx):
|
||||
if wallet.keystores['x3/'].get_tx_derivations(tx):
|
||||
auth_code = self.auth_dialog(window)
|
||||
else:
|
||||
self.print_error("twofactor: xpub3 not needed")
|
||||
|
|
|
@ -194,7 +194,7 @@ class Wallet_2fa(Multisig_Wallet):
|
|||
self.billing_info = None
|
||||
|
||||
def can_sign_without_server(self):
|
||||
return not self.keystores.get('x2/').is_watching_only()
|
||||
return not self.keystores['x2/'].is_watching_only()
|
||||
|
||||
def get_user_id(self):
|
||||
return get_user_id(self.storage)
|
||||
|
|
Loading…
Reference in New Issue