Skip to content

Commit

Permalink
Merge #972: Qt: Uppercase simple bech32 BIP21 URI's for QR code encoding
Browse files Browse the repository at this point in the history
7d884da Uppercase simple bech32 BIP21 URI's for QR code encoding (Kristaps Kaupe)
  • Loading branch information
AdamISZ committed Sep 4, 2021
2 parents 050b28d + 7d884da commit cb0f75d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions scripts/joinmarket-qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
BTCEngine, FidelityBondMixin, wallet_change_passphrase, \
parse_payjoin_setup, send_payjoin, JMBIP78ReceiverManager, \
detect_script_type, general_custom_change_warning, \
nonwallet_custom_change_warning, sweep_custom_change_warning, EngineError
nonwallet_custom_change_warning, sweep_custom_change_warning, EngineError,\
TYPE_P2WPKH
from jmclient.wallet import BaseWallet

from qtsupport import ScheduleWizard, TumbleRestartWizard, config_tips,\
Expand Down Expand Up @@ -1463,7 +1464,17 @@ def create_menu(self, position):
menu.exec_(self.walletTree.viewport().mapToGlobal(position))

def openQRCodePopup(self, address):
popup = QRCodePopup(self, address, btc.encode_bip21_uri(address, {}))
bip21_uri = btc.encode_bip21_uri(address, {})
# From BIP173 (bech32) spec:
# For presentation, lowercase is usually preferable, but inside
# QR codes uppercase SHOULD be used, as those permit the use of
# alphanumeric mode, which is 45% more compact than the normal
# byte mode.
# So we keep case for QR popup title, but convert BIP21 URI to be
# encoded in QR code to uppercase, if possible.
if detect_script_type(mainWindow.wallet_service.addr_to_script(address)) == TYPE_P2WPKH:
bip21_uri = bip21_uri.upper()
popup = QRCodePopup(self, address, bip21_uri)
popup.show()

def updateWalletInfo(self, walletinfo=None):
Expand Down

0 comments on commit cb0f75d

Please sign in to comment.