Browse Source

update Qt for new tumbler algo

master
Adam Gibson 3 years ago
parent
commit
524cbda886
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 14
      scripts/joinmarket-qt.py
  2. 26
      scripts/qtsupport.py

14
scripts/joinmarket-qt.py

@ -73,7 +73,8 @@ from jmclient import load_program_config, get_network, update_persist_config,\
parse_payjoin_setup, send_payjoin, JMBIP78ReceiverManager, \ parse_payjoin_setup, send_payjoin, JMBIP78ReceiverManager, \
detect_script_type, general_custom_change_warning, \ 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, check_and_start_tor, is_extended_public_key TYPE_P2WPKH, check_and_start_tor, is_extended_public_key, \
ScheduleGenerationErrorNoFunds
from jmclient.wallet import BaseWallet from jmclient.wallet import BaseWallet
from qtsupport import ScheduleWizard, TumbleRestartWizard, config_tips,\ from qtsupport import ScheduleWizard, TumbleRestartWizard, config_tips,\
@ -413,8 +414,15 @@ class SpendTab(QWidget):
wizard_return = wizard.exec_() wizard_return = wizard.exec_()
if wizard_return == QDialog.Rejected: if wizard_return == QDialog.Rejected:
return return
self.spendstate.loaded_schedule = wizard.get_schedule( try:
mainWindow.wallet_service.get_balance_by_mixdepth()) self.spendstate.loaded_schedule = wizard.get_schedule(
mainWindow.wallet_service.get_balance_by_mixdepth(),
mainWindow.wallet_service.mixdepth)
except ScheduleGenerationErrorNoFunds:
JMQtMessageBox(self,
"Failed to start tumbler; no funds available.",
title="Tumbler start failed.")
return
self.spendstate.schedule_name = wizard.get_name() self.spendstate.schedule_name = wizard.get_name()
self.updateSchedView() self.updateSchedView()
self.tumbler_options = wizard.opts self.tumbler_options = wizard.opts

26
scripts/qtsupport.py

@ -641,13 +641,12 @@ class SchDynamicPage1(QWizardPage):
self.setTitle("Tumble schedule generation") self.setTitle("Tumble schedule generation")
self.setSubTitle("Set parameters for the sequence of transactions in the tumble.") self.setSubTitle("Set parameters for the sequence of transactions in the tumble.")
results = [] results = []
sN = ['Starting mixdepth', 'Average number of counterparties', sN = ['Average number of counterparties',
'How many mixdepths to tumble through', 'How many mixdepths to tumble through',
'Average wait time between transactions, in minutes', 'Average wait time between transactions, in minutes',
'Average number of transactions per mixdepth'] 'Average number of transactions per mixdepth']
#Tooltips #Tooltips
sH = ["The starting mixdepth can be decided from the Wallet tab; it must\n" sH = [
"have coins in it, but it's OK if some coins are in other mixdepths.",
"How many other participants are in each coinjoin, on average; but\n" "How many other participants are in each coinjoin, on average; but\n"
"each individual coinjoin will have a number that's varied according to\n" "each individual coinjoin will have a number that's varied according to\n"
"settings on the next page", "settings on the next page",
@ -657,11 +656,10 @@ class SchDynamicPage1(QWizardPage):
"varied randomly.", "varied randomly.",
"Will be varied randomly, see advanced settings next page"] "Will be varied randomly, see advanced settings next page"]
#types #types
sT = [int, int, int, float, int] sT = [int, int, float, int]
#constraints #constraints
sMM = [(0, jm_single().config.getint("GUI", "max_mix_depth") - 1), (3, 20), sMM = [(3, 20), (2, 7), (0.00000001, 100.0, 8), (2, 10)]
(2, 7), (0.00000001, 100.0, 8), (2, 10)] sD = ['9', '4', '60.0', '2']
sD = ['0', '9', '4', '60.0', '2']
for x in zip(sN, sH, sT, sD, sMM): for x in zip(sN, sH, sT, sD, sMM):
ql = QLabel(x[0]) ql = QLabel(x[0])
ql.setToolTip(x[1]) ql.setToolTip(x[1])
@ -677,11 +675,10 @@ class SchDynamicPage1(QWizardPage):
layout.addWidget(x[0], i + 1, 0) layout.addWidget(x[0], i + 1, 0)
layout.addWidget(x[1], i + 1, 1, 1, 2) layout.addWidget(x[1], i + 1, 1, 1, 2)
self.setLayout(layout) self.setLayout(layout)
self.registerField("mixdepthsrc", results[0][1]) self.registerField("makercount", results[0][1])
self.registerField("makercount", results[1][1]) self.registerField("mixdepthcount", results[1][1])
self.registerField("mixdepthcount", results[2][1]) self.registerField("timelambda", results[2][1])
self.registerField("timelambda", results[3][1]) self.registerField("txcountparams", results[3][1])
self.registerField("txcountparams", results[4][1])
class SchDynamicPage2(QWizardPage): class SchDynamicPage2(QWizardPage):
@ -834,7 +831,7 @@ class ScheduleWizard(QWizard):
def get_destaddrs(self): def get_destaddrs(self):
return self.destaddrs return self.destaddrs
def get_schedule(self, wallet_balance_by_mixdepth): def get_schedule(self, wallet_balance_by_mixdepth, max_mixdepth_in_wallet):
self.destaddrs = [] self.destaddrs = []
for i in range(self.page(2).required_addresses): for i in range(self.page(2).required_addresses):
daddrstring = str(self.field("destaddr"+str(i))) daddrstring = str(self.field("destaddr"+str(i)))
@ -845,7 +842,6 @@ class ScheduleWizard(QWizard):
title='Error') title='Error')
return None return None
self.opts = {} self.opts = {}
self.opts['mixdepthsrc'] = int(self.field("mixdepthsrc"))
self.opts['mixdepthcount'] = int(self.field("mixdepthcount")) self.opts['mixdepthcount'] = int(self.field("mixdepthcount"))
self.opts['txfee'] = -1 self.opts['txfee'] = -1
self.opts['addrcount'] = len(self.destaddrs) self.opts['addrcount'] = len(self.destaddrs)
@ -864,7 +860,7 @@ class ScheduleWizard(QWizard):
self.opts['rounding_sigfig_weights'] = tuple([int(self.field("rounding_sigfig_weight_" + str(i+1))) for i in range(5)]) self.opts['rounding_sigfig_weights'] = tuple([int(self.field("rounding_sigfig_weight_" + str(i+1))) for i in range(5)])
jm_single().mincjamount = self.opts['mincjamount'] jm_single().mincjamount = self.opts['mincjamount']
return get_tumble_schedule(self.opts, self.destaddrs, return get_tumble_schedule(self.opts, self.destaddrs,
wallet_balance_by_mixdepth) wallet_balance_by_mixdepth, max_mixdepth_in_wallet)
class TumbleRestartWizard(QWizard): class TumbleRestartWizard(QWizard):
def __init__(self): def __init__(self):

Loading…
Cancel
Save