Browse Source

Use get_txtype() / get_outtype() for address type detection

master
Kristaps Kaupe 4 years ago
parent
commit
f741fdd11a
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