show bip39 warning and add info about checksum disabled

This commit is contained in:
ThomasV 2017-08-16 12:40:12 +02:00
parent 322587e493
commit 8b194cd409
1 changed files with 21 additions and 18 deletions

View File

@ -62,22 +62,21 @@ class SeedLayout(QVBoxLayout):
vbox.addWidget(cb_ext) vbox.addWidget(cb_ext)
if 'bip39' in self.options: if 'bip39' in self.options:
def f(b): def f(b):
if b:
msg = ' '.join([
'<b>' + _('Warning') + '</b>' + ': ',
_('BIP39 seeds may not be supported in the future.'),
'<br/><br/>',
_('As technology matures, Bitcoin address generation may change.'),
_('However, BIP39 seeds do not include a version number.'),
_('As a result, it is not possible to infer your wallet type from a BIP39 seed.'),
'<br/><br/>',
_('We do not guarantee that BIP39 seeds will be supported in future versions of Electrum.'),
_('We recommend to use seeds generated by Electrum or compatible wallets.'),
])
#self.parent.show_warning(msg)
self.seed_type_label.setVisible(not b)
self.is_seed = (lambda x: bool(x)) if b else self.saved_is_seed self.is_seed = (lambda x: bool(x)) if b else self.saved_is_seed
self.on_edit() self.on_edit()
if b:
msg = ' '.join([
'<b>' + _('Warning') + ': BIP39 seeds are dangerous!' + '</b><br/><br/>',
_('BIP39 seeds can be imported in Electrum so that users can access funds locked in other wallets.'),
_('However, BIP39 seeds do not include a version number, which compromises compatibility with future wallet software.'),
'<br/><br/>',
_('We do not guarantee that BIP39 imports will always be supported in Electrum.'),
_('In addition, Electrum does not verify the checksum of BIP39 seeds; make sure you type your seed correctly.'),
])
else:
msg = ''
self.seed_warning.setText(msg)
cb_bip39 = QCheckBox(_('BIP39 seed')) cb_bip39 = QCheckBox(_('BIP39 seed'))
cb_bip39.toggled.connect(f) cb_bip39.toggled.connect(f)
cb_bip39.setChecked(self.is_bip39) cb_bip39.setChecked(self.is_bip39)
@ -130,9 +129,10 @@ class SeedLayout(QVBoxLayout):
hbox.addWidget(passphrase_e) hbox.addWidget(passphrase_e)
self.addLayout(hbox) self.addLayout(hbox)
self.addStretch(1) self.addStretch(1)
self.seed_warning = WWLabel('')
self.addWidget(self.seed_warning)
if msg: if msg:
msg = seed_warning_msg(seed) self.seed_warning.setText(seed_warning_msg(seed))
self.addWidget(WWLabel(msg))
def get_seed(self): def get_seed(self):
text = unicode(self.seed_e.text()) text = unicode(self.seed_e.text())
@ -142,8 +142,11 @@ class SeedLayout(QVBoxLayout):
from electrum.bitcoin import seed_type from electrum.bitcoin import seed_type
s = self.get_seed() s = self.get_seed()
b = self.is_seed(s) b = self.is_seed(s)
t = seed_type(s) if not self.is_bip39:
label = _('Seed Type') + ': ' + t if t else '' t = seed_type(s)
label = _('Seed Type') + ': ' + t if t else ''
else:
label = 'BIP39 (checksum disabled)'
self.seed_type_label.setText(label) self.seed_type_label.setText(label)
self.parent.next_button.setEnabled(b) self.parent.next_button.setEnabled(b)