txfees fixer
This commit is contained in:
5
bal.py
5
bal.py
@@ -27,7 +27,6 @@ def get_will(x):
|
|||||||
|
|
||||||
class BalConfig():
|
class BalConfig():
|
||||||
def __init__(self, config, name, default):
|
def __init__(self, config, name, default):
|
||||||
print("init bal_config")
|
|
||||||
self.config = config
|
self.config = config
|
||||||
self.name = name
|
self.name = name
|
||||||
self.default = default
|
self.default = default
|
||||||
@@ -131,8 +130,8 @@ class BalPlugin(BasePlugin):
|
|||||||
self.HIDE_REPLACED.set(self._hide_replaced)
|
self.HIDE_REPLACED.set(self._hide_replaced)
|
||||||
|
|
||||||
def validate_will_settings(self,will_settings):
|
def validate_will_settings(self,will_settings):
|
||||||
print(type(will_settings))
|
#print(type(will_settings))
|
||||||
print(will_settings.get('baltx_fees',1),1)
|
#print(will_settings.get('baltx_fees',1),1)
|
||||||
if int(will_settings.get('baltx_fees',1))<1:
|
if int(will_settings.get('baltx_fees',1))<1:
|
||||||
will_settings['baltx_fees']=1
|
will_settings['baltx_fees']=1
|
||||||
if not will_settings.get('threshold'):
|
if not will_settings.get('threshold'):
|
||||||
|
|||||||
6
qt.py
6
qt.py
@@ -390,6 +390,7 @@ class Plugin(BalPlugin,Logger):
|
|||||||
def load_wallet(self,wallet, main_window):
|
def load_wallet(self,wallet, main_window):
|
||||||
self.logger.info("HOOK load wallet")
|
self.logger.info("HOOK load wallet")
|
||||||
w = self.get_window(main_window)
|
w = self.get_window(main_window)
|
||||||
|
#havetoupdate = Util.fix_will_settings_tx_fees(wallet.db)
|
||||||
w.wallet = wallet
|
w.wallet = wallet
|
||||||
w.init_will()
|
w.init_will()
|
||||||
w.willexecutors = Willexecutors.get_willexecutors(self, update=False, bal_window=w)
|
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))
|
self.heirs = Heirs._validate(Heirs(self.wallet.db))
|
||||||
if not self.will:
|
if not self.will:
|
||||||
self.will=self.wallet.db.get_dict("will")
|
self.will=self.wallet.db.get_dict("will")
|
||||||
|
Util.fix_will_tx_fees(self.will)
|
||||||
if self.will:
|
if self.will:
|
||||||
self.willitems = {}
|
self.willitems = {}
|
||||||
try:
|
try:
|
||||||
@@ -587,6 +589,8 @@ class BalWindow(Logger):
|
|||||||
|
|
||||||
if not self.will_settings:
|
if not self.will_settings:
|
||||||
self.will_settings=self.wallet.db.get_dict("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))
|
self.logger.info("will_settings: {}".format(self.will_settings))
|
||||||
if not self.will_settings:
|
if not self.will_settings:
|
||||||
Util.copy(self.will_settings,self.bal_plugin.default_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):
|
def __init__(self,bal_window,parent=None):
|
||||||
if not parent:
|
if not parent:
|
||||||
parent = bal_window.window
|
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.updatemessage.connect(self.update)
|
||||||
self.bal_window=bal_window
|
self.bal_window=bal_window
|
||||||
self.message_label = QLabel("Building Will:")
|
self.message_label = QLabel("Building Will:")
|
||||||
|
|||||||
19
util.py
19
util.py
@@ -435,3 +435,22 @@ class Util:
|
|||||||
def copy(dicto,dictfrom):
|
def copy(dicto,dictfrom):
|
||||||
for k,v in dictfrom.items():
|
for k,v in dictfrom.items():
|
||||||
dicto[k]=v
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user