diff --git a/heirs.py b/heirs.py
index 4a83f73..8368976 100644
--- a/heirs.py
+++ b/heirs.py
@@ -368,14 +368,18 @@ class Heirs(dict, Logger):
fixed_amount = 0.0
percent_heirs = {}
percent_amount = 0.0
- fixed_amount_with_dust =0.0
+ fixed_amount_with_dust = 0.0
for key in self.keys():
try:
cmp = (
Util.parse_locktime_string(self[key][HEIR_LOCKTIME]) - from_locktime
)
if cmp <= 0:
- _logger.debug("cmp < 0 {} {} {} ".format(cmp, key, self[key][HEIR_LOCKTIME], from_locktime))
+ _logger.debug(
+ "cmp < 0 {} {} {} ".format(
+ cmp, key, self[key][HEIR_LOCKTIME], from_locktime
+ )
+ )
continue
if Util.is_perc(self[key][HEIR_AMOUNT]):
percent_amount += float(self[key][HEIR_AMOUNT][:-1])
@@ -389,11 +393,19 @@ class Heirs(dict, Logger):
fixed_heirs[key].insert(HEIR_REAL_AMOUNT, heir_amount)
else:
fixed_heirs[key] = list(self[key])
- fixed_heirs[key].insert(HEIR_REAL_AMOUNT, f"DUST: {heir_amount}")
+ fixed_heirs[key].insert(
+ HEIR_REAL_AMOUNT, f"DUST: {heir_amount}"
+ )
fixed_heirs[key].insert(HEIR_DUST_AMOUNT, heir_amount)
except Exception as e:
_logger.error(e)
- return fixed_heirs, fixed_amount, percent_heirs, percent_amount, fixed_amount_with_dust
+ return (
+ fixed_heirs,
+ fixed_amount,
+ percent_heirs,
+ percent_amount,
+ fixed_amount_with_dust,
+ )
def prepare_lists(
self, balance, total_fees, wallet, willexecutor=False, from_locktime=0
@@ -426,13 +438,19 @@ class Heirs(dict, Logger):
),
heir_list.update(willexecutors)
newbalance -= willexecutors_amount
- if newbalance<0:
+ if newbalance < 0:
raise WillExecutorFeeException(willexecutor)
- a=list(self.fixed_percent_lists_amount(from_locktime, wallet.dust_threshold()))
- fixed_heirs, fixed_amount, percent_heirs, percent_amount,fixed_amount_with_dust = (
- self.fixed_percent_lists_amount(from_locktime, wallet.dust_threshold())
- )
-
+ a = list(
+ self.fixed_percent_lists_amount(from_locktime, wallet.dust_threshold())
+ )
+ (
+ fixed_heirs,
+ fixed_amount,
+ percent_heirs,
+ percent_amount,
+ fixed_amount_with_dust,
+ ) = self.fixed_percent_lists_amount(from_locktime, wallet.dust_threshold())
+
if fixed_amount > newbalance:
fixed_amount = self.normalize_perc(
fixed_heirs, newbalance, fixed_amount, wallet
@@ -520,7 +538,7 @@ class Heirs(dict, Logger):
break
fees = {}
i = 0
- while i<10:
+ while i < 10:
txs = {}
redo = False
i += 1
@@ -533,7 +551,7 @@ class Heirs(dict, Logger):
balance, total_fees, wallet, willexecutor, from_locktime
)
except WillExecutorFeeException as e:
- i=10
+ i = 10
continue
if locktimes:
try:
@@ -543,7 +561,9 @@ class Heirs(dict, Logger):
if not txs:
return {}
except Exception as e:
- _logger.error(f"build transactions: error preparing transactions: {e}")
+ _logger.error(
+ f"build transactions: error preparing transactions: {e}"
+ )
try:
if "w!ll3x3c" in e.heirname:
Willexecutors.is_selected(willexecutors[w], False)
@@ -573,10 +593,12 @@ class Heirs(dict, Logger):
if i >= 10:
break
else:
- _logger.info(f"no locktimes for willexecutor {willexecutor} skipped")
+ _logger.info(
+ f"no locktimes for willexecutor {willexecutor} skipped"
+ )
break
alltxs.update(txs)
-
+
return alltxs
def get_transactions(
@@ -733,10 +755,17 @@ class HeirExpiredException(LocktimeNotValid):
class HeirAmountIsDustException(Exception):
pass
+
+
class NoHeirsException(Exception):
pass
+
+
class WillExecutorFeeException(Exception):
- def __init__(self,willexecutor):
- self.willexecutor=willexecutor
+ def __init__(self, willexecutor):
+ self.willexecutor = willexecutor
+
def __str__(self):
- return "WillExecutorFeeException: {} fee:{}".format(self.willexecutor['url'],self.willexecutor['base_fee'])
+ return "WillExecutorFeeException: {} fee:{}".format(
+ self.willexecutor["url"], self.willexecutor["base_fee"]
+ )
diff --git a/manifest.json b/manifest.json
index 80a6690..e941a05 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,9 +1,8 @@
{
- "name": "BAL",
- "fullname": "Bitcoin After Life",
- "description": "Provides free and decentralized inheritance support
Version: 0.2.4",
- "author":"Svatantrya",
- "available_for": ["qt"],
- "icon":"icons/bal32x32.png"
- }
-
+ "name": "BAL",
+ "fullname": "Bitcoin After Life",
+ "description": "Provides free and decentralized inheritance support
Version: 0.2.4",
+ "author": "Svatantrya",
+ "available_for": ["qt"],
+ "icon": "icons/bal32x32.png",
+}
diff --git a/qt.py b/qt.py
index c738f71..4ec4d9f 100644
--- a/qt.py
+++ b/qt.py
@@ -628,7 +628,7 @@ class BalWindow(Logger):
try:
del self.heirs[heir]
except Exception as e:
- _logger.debug(f"error deleting heir: {heir} {e}")
+ _logger.debug(f"error deleting heir: {heir} {e}")
pass
self.heirs.save()
self.heir_list.update()
@@ -2038,9 +2038,9 @@ class bal_checkbox(QCheckBox):
class BalBuildWillDialog(BalDialog):
updatemessage = pyqtSignal()
- COLOR_WARNING='#cfa808'
- COLOR_ERROR='#ff0000'
- COLOR_OK='#05ad05'
+ COLOR_WARNING = "#cfa808"
+ COLOR_ERROR = "#ff0000"
+ COLOR_OK = "#05ad05"
def __init__(self, bal_window, parent=None):
if not parent:
@@ -2097,7 +2097,7 @@ class BalBuildWillDialog(BalDialog):
self.bal_window.window.wallet.dust_threshold(),
)
_logger.debug("variables ok")
- self.msg_set_status("checking variables:", varrow, "Ok",self.COLOR_OK)
+ self.msg_set_status("checking variables:", varrow, "Ok", self.COLOR_OK)
except AmountException:
self.msg_set_status(
"checking variables",
@@ -2107,7 +2107,7 @@ class BalBuildWillDialog(BalDialog):
+ "the entire wallet will always be fully emptied. \n"
+ "Your settings require an adjustment of the amounts"
),
- self.COLOR_WARNING
+ self.COLOR_WARNING,
)
self.msg_set_checking()
@@ -2150,19 +2150,19 @@ class BalBuildWillDialog(BalDialog):
try:
if not self.bal_window.build_will():
self.msg_set_status(
- _("Balance is too low. No transaction was built"),None,_("Skipped"),self.COLOR_ERROR
+ _("Balance is too low. No transaction was built"),
+ None,
+ _("Skipped"),
+ self.COLOR_ERROR,
)
-
+
self.bal_window.check_will()
for wid in Will.only_valid(self.bal_window.willitems):
self.bal_window.wallet.set_label(wid, "BAL Transaction")
self.msg_set_building(self.msg_ok())
except WillExecutorNotPresent as e:
self.msg_set_status(
- _("Will-Executor excluded"),
- None,
- _("Skipped"),
- self.COLOR_ERROR
+ _("Will-Executor excluded"), None, _("Skipped"), self.COLOR_ERROR
)
except Exception as e:
@@ -2175,10 +2175,10 @@ class BalBuildWillDialog(BalDialog):
for hid, heir in heirs.items():
if "DUST" in str(heir[HEIR_REAL_AMOUNT]):
self.msg_set_status(
- f'{hid},{heir[HEIR_DUST_AMOUNT]} is DUST',
+ f"{hid},{heir[HEIR_DUST_AMOUNT]} is DUST",
None,
f"Excluded from will {wid}",
- self.COLOR_WARNING
+ self.COLOR_WARNING,
)
have_to_sign = False
@@ -2430,20 +2430,19 @@ class BalBuildWillDialog(BalDialog):
self.wait_row = self.msg_edit_row(f"Please wait {status}secs", self.wait_row)
def msg_error(self, e):
- return "{}".format(self.COLOR_ERROR,e)
+ return "{}".format(self.COLOR_ERROR, e)
def msg_ok(self, e="Ok"):
- return "{}".format(self.COLOR_OK,e)
+ return "{}".format(self.COLOR_OK, e)
def msg_warning(self, e):
- return "{}{}{}:\t{}".format(color,_(msg), status)
+ line = "{}:\t{}".format(color, _(msg), status)
return self.msg_edit_row(line, row)
-
def ask_password(self, msg=None):
self.password = self.bal_window.get_wallet_password(msg, parent=self)
@@ -2560,9 +2559,9 @@ class HeirList(MyTreeView, MessageBoxMixin):
except Exception:
self.update()
- def delete_heirs(self,selected_keys):
- self.bal_window.delete_heirs(selected_keys)
- self.update()
+ def delete_heirs(self, selected_keys):
+ self.bal_window.delete_heirs(selected_keys)
+ self.update()
def create_menu(self, position):
menu = QMenu()
@@ -2591,9 +2590,7 @@ class HeirList(MyTreeView, MessageBoxMixin):
_("Edit {}").format(column_title),
lambda p=persistent: self.edit(QModelIndex(p)),
)
- menu.addAction(
- _("Delete"), lambda: self.delete_heirs(selected_keys)
- )
+ menu.addAction(_("Delete"), lambda: self.delete_heirs(selected_keys))
menu.exec(self.viewport().mapToGlobal(position))
# def get_selected_keys(self):
diff --git a/will.py b/will.py
index 1627675..78c7f56 100644
--- a/will.py
+++ b/will.py
@@ -470,7 +470,7 @@ class Will:
Will.reflect_to_children(wc)
def check_amounts(heirs, willexecutors, all_utxos, timestamp_to_check, dust):
- fixed_heirs, fixed_amount, perc_heirs, perc_amount,fixed_amount_with_dust = (
+ fixed_heirs, fixed_amount, perc_heirs, perc_amount, fixed_amount_with_dust = (
heirs.fixed_percent_lists_amount(timestamp_to_check, dust, reverse=True)
)
wallet_balance = 0
@@ -622,7 +622,7 @@ class Will:
_logger.debug(
f"heir not present transaction is not valid:{wheir} {wid}, {w}"
)
-
+
if willexecutor := w.we:
count = willexecutors_found.get(willexecutor["url"], 0)
if Util.cmp_willexecutor(
@@ -634,7 +634,7 @@ class Will:
no_willexecutor += 1
count_heirs = 0
for h in heirs:
-
+
if Util.parse_locktime_string(heirs[h][2]) >= check_date:
count_heirs += 1
if not h in heirs_found: