black reformatted

This commit is contained in:
2026-03-05 10:47:59 -04:00
parent ef0ab56de4
commit b012dd7a68
4 changed files with 80 additions and 55 deletions

View File

@@ -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"]
)