Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gruve-p committed May 31, 2024
2 parents f96d605 + 15f13eb commit 9b3028c
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 36 deletions.
2 changes: 2 additions & 0 deletions contrib/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ if [ "$GPGUSER" == "jackielove4u" ]; then
PUBKEY="--local-user 287A E4CA1187C68C08B49CB2D11BD4F33F1DB499"
export SSHUSER=jackielove4u
RELEASEMANAGER=1
else
warn "unexpected GPGUSER=$GPGUSER"
fi


Expand Down
2 changes: 1 addition & 1 deletion electrum_grs/bip21.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def parse_bip21_URI(uri: str) -> dict:
amount_sat = out.get('amount')
if amount_sat:
# allow small leeway due to msat precision
if lnaddr.get_amount_msat() is None or abs(amount_sat - int(lnaddr.get_amount_sat())) > 1:
if lnaddr.get_amount_sat() is None or abs(amount_sat - int(lnaddr.get_amount_sat())) > 1:
raise InvalidBitcoinURI("Inconsistent lightning field in bip21: amount")
address = out.get('address')
ln_fallback_addr = lnaddr.get_fallback_address()
Expand Down
12 changes: 6 additions & 6 deletions electrum_grs/gui/qml/components/OpenChannelDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ ElDialog {
visible: !Daemon.currentWallet.lightningHasDeterministicNodeId
iconStyle: InfoTextArea.IconStyle.Warn
text: Daemon.currentWallet.seedType == 'segwit'
? [ qsTr('Your channels cannot be recovered from seed, because they were created with an old version of Electrum.'),
qsTr('This means that you must save a backup of your wallet everytime you create a new channel.'),
? [ qsTr('Your channels cannot be recovered from seed, because they were created with an old version of Electrum.'), ' ',
qsTr('This means that you must save a backup of your wallet every time you create a new channel.'),
'\n\n',
qsTr('If you want this wallet to have recoverable channels, you must close your existing channels and restore this wallet from seed.')
].join(' ')
: [ qsTr('Your channels cannot be recovered from seed.'),
qsTr('This means that you must save a backup of your wallet everytime you create a new channel.'),
].join('')
: [ qsTr('Your channels cannot be recovered from seed.'), ' ',
qsTr('This means that you must save a backup of your wallet every time you create a new channel.'),
'\n\n',
qsTr('If you want to have recoverable channels, you must create a new wallet with an Electrum seed')
].join(' ')
].join('')
}

InfoTextArea {
Expand Down
13 changes: 12 additions & 1 deletion electrum_grs/gui/qml/components/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ ApplicationWindow
Component {
id: _scanDialog
QRScanner {
//onClosed: destroy()
onFinished: destroy()
}
}
Component {
Expand Down Expand Up @@ -629,6 +629,17 @@ ApplicationWindow

function handleAuthRequired(qtobject, method, authMessage) {
console.log('auth using method ' + method)

if (method == 'wallet_else_pin') {
// if there is a loaded wallet and all wallets use the same password, use that
// else delegate to pin auth
if (Daemon.currentWallet && Daemon.singlePasswordEnabled) {
method = 'wallet'
} else {
method = 'pin'
}
}

if (method == 'wallet') {
if (Daemon.currentWallet.verifyPassword('')) {
// wallet has no password
Expand Down
2 changes: 1 addition & 1 deletion electrum_grs/gui/qml/qeconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def pinCode(self, pin_code):
self.config.CONFIG_PIN_CODE = pin_code
self.pinCodeChanged.emit()

@auth_protect(method='wallet')
@auth_protect(method='wallet_else_pin')
def pinCodeRemoveAuth(self):
self.config.CONFIG_PIN_CODE = ""
self.pinCodeChanged.emit()
Expand Down
48 changes: 28 additions & 20 deletions electrum_grs/gui/qml/qeqrscanner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from PyQt6.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
from PyQt6.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, Qt
from PyQt6.QtGui import QGuiApplication

from electrum_grs.util import send_exception_to_crash_reporter, UserFacingException
Expand All @@ -10,7 +10,7 @@


if 'ANDROID_DATA' in os.environ:
from jnius import autoclass, cast
from jnius import autoclass
from android import activity

jpythonActivity = autoclass('org.kivy.android.PythonActivity').mActivity
Expand All @@ -23,10 +23,18 @@ class QEQRScanner(QObject):

found = pyqtSignal()

finished = pyqtSignal()

def __init__(self, parent=None):
super().__init__(parent)
self._hint = _("Scan a QR code.")
self._scan_data = "" # decoded qr code result
self.finished.connect(self._unbind, Qt.ConnectionType.QueuedConnection)

self.destroyed.connect(lambda: self.on_destroy())

def on_destroy(self):
self._unbind()

@pyqtProperty(str)
def hint(self):
Expand All @@ -49,34 +57,34 @@ def open(self):
if 'ANDROID_DATA' not in os.environ:
self._scan_qr_non_android()
return
SimpleScannerActivity = autoclass("org.electrum.qr.SimpleScannerActivity")
intent = jIntent(jpythonActivity, SimpleScannerActivity)
jSimpleScannerActivity = autoclass("org.electrum.qr.SimpleScannerActivity")
intent = jIntent(jpythonActivity, jSimpleScannerActivity)
intent.putExtra(jIntent.EXTRA_TEXT, jString(self._hint))

def on_qr_result(requestCode, resultCode, intent):
try:
if resultCode == -1: # RESULT_OK:
# this doesn't work due to some bug in jnius:
# contents = intent.getStringExtra("text")
contents = intent.getStringExtra(jString("text"))
#self._logger.info(f"on_qr_result. {contents=!r}")
self.scanData = contents
self.found.emit()
except Exception as e: # exc would otherwise get lost
send_exception_to_crash_reporter(e)
finally:
activity.unbind(on_activity_result=on_qr_result)
activity.bind(on_activity_result=on_qr_result)
activity.bind(on_activity_result=self.on_qr_activity_result)
jpythonActivity.startActivityForResult(intent, 0)

def on_qr_activity_result(self, requestCode, resultCode, intent):
try:
if resultCode == -1: # RESULT_OK:
contents = intent.getStringExtra(jString("text"))
self.scanData = contents
self.found.emit()
except Exception as e: # exc would otherwise get lost
send_exception_to_crash_reporter(e)
finally:
self.finished.emit()

@pyqtSlot()
def close(self):
pass
def _unbind(self):
if 'ANDROID_DATA' in os.environ:
activity.unbind(on_activity_result=self.on_qr_activity_result)

def _scan_qr_non_android(self):
data = QGuiApplication.clipboard().text()
self.scanData = data
self.found.emit()
self.finished.emit()
return
# from electrum import qrscanner
# from .qeapp import ElectrumQmlApplication
Expand Down
2 changes: 1 addition & 1 deletion electrum_grs/gui/qt/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1858,7 +1858,7 @@ def init_lightning_dialog(self, dialog):
else:
msg = _(
"Warning: this wallet type does not support channel recovery from seed. "
"You will need to backup your wallet everytime you create a new channel. "
"You will need to backup your wallet every time you create a new channel. "
"Create lightning keys?")
if self.question(msg):
self._init_lightning_dialog(dialog=dialog)
Expand Down
4 changes: 2 additions & 2 deletions electrum_grs/gui/qt/wallet_info_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ def __init__(self, parent: QWidget, *, window: 'ElectrumWindow'):
grid.addWidget(label, cur_row, 1)
if wallet.get_seed_type() == 'segwit':
msg = _("Your channels cannot be recovered from seed, because they were created with an old version of Electrum. "
"This means that you must save a backup of your wallet everytime you create a new channel.\n\n"
"This means that you must save a backup of your wallet every time you create a new channel.\n\n"
"If you want this wallet to have recoverable channels, you must close your existing channels and restore this wallet from seed")
else:
msg = _("Your channels cannot be recovered from seed. "
"This means that you must save a backup of your wallet everytime you create a new channel.\n\n"
"This means that you must save a backup of your wallet every time you create a new channel.\n\n"
"If you want to have recoverable channels, you must create a new wallet with an Electrum seed")
grid.addWidget(HelpButton(msg), cur_row, 3)
cur_row += 1
Expand Down
4 changes: 2 additions & 2 deletions electrum_grs/version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ELECTRUM_VERSION = '4.5.4' # version of the client package
APK_VERSION = '4.5.4.0' # read by buildozer.spec
ELECTRUM_VERSION = '4.5.5' # version of the client package
APK_VERSION = '4.5.5.0' # read by buildozer.spec

PROTOCOL_VERSION = '1.4' # protocol version requested

Expand Down
4 changes: 2 additions & 2 deletions electrum_grs/wallet_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -1197,9 +1197,9 @@ def get_seed_version(self):
if not seed_version:
seed_version = OLD_SEED_VERSION if len(self.get('master_public_key','')) == 128 else NEW_SEED_VERSION
if seed_version > FINAL_SEED_VERSION:
raise WalletFileException('This version of Electrum-GRS is too old to open this wallet.\n'
raise WalletFileException('This version of Electrum-GRS ({}) is too old to open this wallet.\n'
'(highest supported storage version: {}, version of this file: {})'
.format(FINAL_SEED_VERSION, seed_version))
.format(ELECTRUM_VERSION, FINAL_SEED_VERSION, seed_version))
if seed_version == 14 and self.get('seed_type') == 'segwit':
self._raise_unsupported_version(seed_version)
if seed_version == 51 and self._detect_insane_version_51():
Expand Down

0 comments on commit 9b3028c

Please sign in to comment.