diff --git a/bal.py b/bal.py index 183a49b..75b1a54 100644 --- a/bal.py +++ b/bal.py @@ -27,7 +27,6 @@ def get_will(x): class BalConfig(): def __init__(self, config, name, default): - print("init bal_config") self.config = config self.name = name self.default = default @@ -131,8 +130,8 @@ class BalPlugin(BasePlugin): self.HIDE_REPLACED.set(self._hide_replaced) def validate_will_settings(self,will_settings): - print(type(will_settings)) - print(will_settings.get('baltx_fees',1),1) + #print(type(will_settings)) + #print(will_settings.get('baltx_fees',1),1) if int(will_settings.get('baltx_fees',1))<1: will_settings['baltx_fees']=1 if not will_settings.get('threshold'): diff --git a/qt.py b/qt.py index 9ad0fea..7d409bd 100644 --- a/qt.py +++ b/qt.py @@ -390,6 +390,7 @@ class Plugin(BalPlugin,Logger): def load_wallet(self,wallet, main_window): self.logger.info("HOOK load wallet") w = self.get_window(main_window) + #havetoupdate = Util.fix_will_settings_tx_fees(wallet.db) w.wallet = wallet w.init_will() w.willexecutors = Willexecutors.get_willexecutors(self, update=False, bal_window=w) @@ -575,6 +576,7 @@ class BalWindow(Logger): self.heirs = Heirs._validate(Heirs(self.wallet.db)) if not self.will: self.will=self.wallet.db.get_dict("will") + Util.fix_will_tx_fees(self.will) if self.will: self.willitems = {} try: @@ -587,6 +589,8 @@ class BalWindow(Logger): if not self.will_settings: self.will_settings=self.wallet.db.get_dict("will_settings") + Util.fix_will_settings_tx_fees(self.will_settings) + self.logger.info("will_settings: {}".format(self.will_settings)) if not self.will_settings: Util.copy(self.will_settings,self.bal_plugin.default_will_settings()) @@ -1856,7 +1860,7 @@ class BalBuildWillDialog(BalDialog): def __init__(self,bal_window,parent=None): if not parent: parent = bal_window.window - BalDialog.__init__(self,parent,babl_window.bal_plugin, "Building Will") + BalDialog.__init__(self,parent,bal_window.bal_plugin, "Building Will") self.updatemessage.connect(self.update) self.bal_window=bal_window self.message_label = QLabel("Building Will:") diff --git a/util.py b/util.py index 8090b7f..003aa8c 100644 --- a/util.py +++ b/util.py @@ -435,3 +435,22 @@ class Util: def copy(dicto,dictfrom): for k,v in dictfrom.items(): dicto[k]=v + + def fix_will_settings_tx_fees(will_settings): + tx_fees = will_settings.get('tx_fees',False) + have_to_update=False + if tx_fees: + will_settings['baltx_fees']=tx_fees + del will_settings['tx_fees'] + have_to_update=True + return have_to_update + + def fix_will_tx_fees(will): + have_to_update = False + for txid,willitem in will.items(): + tx_fees=willitem.get('tx_fees',False) + if tx_fees: + will[txid]['baltx_fees']=tx_fees + del will[txid]['tx_fees'] + have_to_update=True + return have_to_update