Browse Source

Merge JoinMarket-Org/joinmarket-clientserver#1184: Use get_txtype() / get_outtype() for address type detection

f741fdd11a Use get_txtype() / get_outtype() for address type detection (Kristaps Kaupe)

Pull request description:

  Properly handles fidelity bond wallets, see https://github.com/JoinMarket-Org/joinmarket-clientserver/pull/1174#issuecomment-1041836251.

ACKs for top commit:
  AdamISZ:
    tACK f741fdd11a

Tree-SHA512: 89c16ef4a96ce2008dd36c8c4800e4854bef11d42be471ac7b2fcb60a8650d532ae5f0920fd2d200b60931b1eeb6dad857e27e2b2fb8a338b266efd7be34d3d3
master
Kristaps Kaupe 4 years ago
parent
commit
f3ee764ae3
No known key found for this signature in database
GPG Key ID: 33E472FE870C7E5D
  1. 6
      scripts/joinmarket-qt.py
  2. 7
      scripts/sendpayment.py

6
scripts/joinmarket-qt.py

@ -1211,13 +1211,13 @@ class SpendTab(QWidget):
if reply == QMessageBox.No: if reply == QMessageBox.No:
return False return False
change_spk = mainWindow.wallet_service.addr_to_script(change_addr)
engine_recognized = True engine_recognized = True
try: try:
change_addr_type = detect_script_type(change_spk) change_addr_type = mainWindow.wallet_service.get_outtype(
change_addr)
except EngineError: except EngineError:
engine_recognized = False engine_recognized = False
wallet_type = mainWindow.wallet_service.TYPE wallet_type = mainWindow.wallet_service.get_txtype()
if (not engine_recognized) or ( if (not engine_recognized) or (
change_addr_type != wallet_type and makercount > 0): change_addr_type != wallet_type and makercount > 0):
reply = JMQtMessageBox(self, reply = JMQtMessageBox(self,

7
scripts/sendpayment.py

@ -18,7 +18,7 @@ from jmclient import Taker, load_program_config, get_schedule,\
get_sendpayment_parser, get_max_cj_fee_values, check_regtest, \ get_sendpayment_parser, get_max_cj_fee_values, check_regtest, \
parse_payjoin_setup, send_payjoin, general_custom_change_warning, \ parse_payjoin_setup, send_payjoin, general_custom_change_warning, \
nonwallet_custom_change_warning, sweep_custom_change_warning, \ nonwallet_custom_change_warning, sweep_custom_change_warning, \
detect_script_type, EngineError EngineError
from twisted.python.log import startLogging from twisted.python.log import startLogging
from jmbase.support import get_log, jmprint, \ from jmbase.support import get_log, jmprint, \
EXIT_FAILURE, EXIT_ARGERROR EXIT_FAILURE, EXIT_ARGERROR
@ -229,14 +229,13 @@ def main():
if not options.answeryes and input( if not options.answeryes and input(
general_custom_change_warning + " (y/n):")[0] != "y": general_custom_change_warning + " (y/n):")[0] != "y":
sys.exit(EXIT_ARGERROR) sys.exit(EXIT_ARGERROR)
change_spk = wallet_service.addr_to_script(custom_change)
engine_recognized = True engine_recognized = True
try: try:
change_addr_type = detect_script_type(change_spk) change_addr_type = wallet_service.get_outtype(custom_change)
except EngineError: except EngineError:
engine_recognized = False engine_recognized = False
if (not engine_recognized) or ( if (not engine_recognized) or (
change_addr_type != wallet_service.TYPE): change_addr_type != wallet_service.get_txtype()):
if not options.answeryes and input( if not options.answeryes and input(
nonwallet_custom_change_warning + " (y/n):")[0] != "y": nonwallet_custom_change_warning + " (y/n):")[0] != "y":
sys.exit(EXIT_ARGERROR) sys.exit(EXIT_ARGERROR)

Loading…
Cancel
Save