2 Commits

Author SHA1 Message Date
dff508c25b version 2026-04-08 11:17:54 -04:00
2056ffae7f check alive updated 2026-04-08 11:16:59 -04:00
5 changed files with 49 additions and 39 deletions

View File

@@ -1 +1 @@
0.2.7 0.2.8

2
bal.py
View File

@@ -109,7 +109,7 @@ class BalPlugin(BasePlugin):
"base_fee": 100000, "base_fee": 100000,
"status": "New", "status": "New",
"info": "Bitcoin After Life Will Executor", "info": "Bitcoin After Life Will Executor",
"address": "bcrt1qa5cntu4hgadw8zd3n6sq2nzjy34sxdtd9u0gp7", "address": "bc1qusymuetsz2psaqzqxv8qmzcy64d9meckj3lxxf",
"selected": True, "selected": True,
} }
}, },

View File

@@ -341,7 +341,6 @@ class Heirs(dict, Logger):
def normalize_perc( def normalize_perc(
self, heir_list, total_balance, relative_balance, wallet, real=False self, heir_list, total_balance, relative_balance, wallet, real=False
): ):
print("relative balance", relative_balance)
amount = 0 amount = 0
for key, v in heir_list.items(): for key, v in heir_list.items():
try: try:
@@ -426,15 +425,7 @@ class Heirs(dict, Logger):
self, balance, total_fees, wallet, willexecutor=False, from_locktime=0 self, balance, total_fees, wallet, willexecutor=False, from_locktime=0
): ):
if balance<total_fees or balance < wallet.dust_threshold(): if balance<total_fees or balance < wallet.dust_threshold():
print("balance < total_fees")
raise BalanceTooLowException(balance,wallet.dust_threshold(),total_fees) raise BalanceTooLowException(balance,wallet.dust_threshold(),total_fees)
print("prepare lists")
print("balance",balance)
print("total fees",total_fees)
print("willexecutor", willexecutor)
print("from_locktime", from_locktime)
print("wallet",wallet)
print("dust threshold",wallet.dust_threshold())
willexecutors_amount = 0 willexecutors_amount = 0
willexecutors = {} willexecutors = {}
heir_list = {} heir_list = {}
@@ -462,8 +453,6 @@ class Heirs(dict, Logger):
f"heir excluded from will locktime({locktime}){Util.int_locktime(locktime)}<minimum{from_locktime}" f"heir excluded from will locktime({locktime}){Util.int_locktime(locktime)}<minimum{from_locktime}"
), ),
heir_list.update(willexecutors) heir_list.update(willexecutors)
print("willexecutor amount", willexecutors_amount)
print("heir_list",heir_list)
newbalance -= willexecutors_amount newbalance -= willexecutors_amount
if newbalance < 0: if newbalance < 0:
raise WillExecutorFeeException(willexecutor) raise WillExecutorFeeException(willexecutor)
@@ -474,9 +463,7 @@ class Heirs(dict, Logger):
percent_amount, percent_amount,
fixed_amount_with_dust, fixed_amount_with_dust,
) = self.fixed_percent_lists_amount(from_locktime, wallet.dust_threshold()) ) = self.fixed_percent_lists_amount(from_locktime, wallet.dust_threshold())
print("qua non ci arriva 1")
if fixed_amount > newbalance: if fixed_amount > newbalance:
print(fixed_heirs,newbalance,fixed_amount)
fixed_amount = self.normalize_perc( fixed_amount = self.normalize_perc(
fixed_heirs, newbalance, fixed_amount, wallet fixed_heirs, newbalance, fixed_amount, wallet
) )
@@ -485,15 +472,12 @@ class Heirs(dict, Logger):
heir_list.update(fixed_heirs) heir_list.update(fixed_heirs)
newbalance -= fixed_amount newbalance -= fixed_amount
print("new balance", newbalance)
if newbalance > 0: if newbalance > 0:
perc_amount = self.normalize_perc( perc_amount = self.normalize_perc(
percent_heirs, newbalance, percent_amount, wallet percent_heirs, newbalance, percent_amount, wallet
) )
print("normalize perc", perc_amount)
newbalance -= perc_amount newbalance -= perc_amount
heir_list.update(percent_heirs) heir_list.update(percent_heirs)
print("newbalance2",newbalance)
if newbalance > 0: if newbalance > 0:
newbalance += fixed_amount newbalance += fixed_amount
fixed_amount = self.normalize_perc( fixed_amount = self.normalize_perc(
@@ -514,7 +498,6 @@ class Heirs(dict, Logger):
locktimes[locktime] = {key: value} locktimes[locktime] = {key: value}
else: else:
locktimes[locktime][key] = value locktimes[locktime][key] = value
print(2)
return locktimes, onlyfixed return locktimes, onlyfixed
def is_perc(self, key): def is_perc(self, key):
@@ -582,11 +565,9 @@ class Heirs(dict, Logger):
continue continue
if locktimes: if locktimes:
try: try:
print(3)
txs = prepare_transactions( txs = prepare_transactions(
locktimes, available_utxos[:], fees, wallet locktimes, available_utxos[:], fees, wallet
) )
print(4)
if not txs: if not txs:
return {} return {}
except Exception as e: except Exception as e:

64
qt.py
View File

@@ -22,6 +22,7 @@ except Exception:
QT_VERSION = 6 QT_VERSION = 6
if QT_VERSION == 5: if QT_VERSION == 5:
from PyQt5.QtCore import QThread, QCoreApplication
from PyQt5.QtCore import ( from PyQt5.QtCore import (
QDateTime, QDateTime,
QModelIndex, QModelIndex,
@@ -57,6 +58,7 @@ if QT_VERSION == 5:
QWidget, QWidget,
) )
else: # QT6 else: # QT6
from PyQt6.QtCore import QThread, QCoreApplication
from PyQt6.QtCore import ( from PyQt6.QtCore import (
QDateTime, QDateTime,
QModelIndex, QModelIndex,
@@ -779,7 +781,7 @@ class BalWindow(Logger):
except AmountException as e: except AmountException as e:
self.show_warning( self.show_warning(
_( _(
f"In the inheritance process, the entire wallet will always be fully emptied. Your settings require an adjustment of the amounts.\n{e}" f"In the inheritance process, the entire wallet will always be fully emptied. Your settings require an adjustment of the amounts.{e}"
) )
) )
except CheckAliveException: except CheckAliveException:
@@ -1030,7 +1032,18 @@ class BalWindow(Logger):
) )
def on_failure(err): def on_failure(err):
a,b,c = err
self.logger.error(f"fail to broadcast transactions:{err}") self.logger.error(f"fail to broadcast transactions:{err}")
self.logger.error(f"error: {b}")
self.logger.error(f"traceback ")
tb = c
while tb is not None:
frame = tb.tb_frame
self.logger.error("file:", frame.f_code.co_filename)
self.logger.error("name:", frame.f_code.co_name)
self.logger.error("line:", tb.tb_lineno)
self.logger.error("lasti:", tb.tb_lasti)
tb = tb.tb_next
task = partial(self.push_transactions_to_willexecutors, force) task = partial(self.push_transactions_to_willexecutors, force)
msg = _("Selecting Will-Executors") msg = _("Selecting Will-Executors")
@@ -1040,7 +1053,7 @@ class BalWindow(Logger):
self.waiting_dialog.exe() self.waiting_dialog.exe()
def push_transactions_to_willexecutors(self, force=False): def push_transactions_to_willexecutors(self, force=False):
willexecutors = Willexecutors.get_willexecutor_transactions(self.bal_plugin, self.willitems) willexecutors = Willexecutors.get_willexecutor_transactions(self.willitems)
def getMsg(willexecutors): def getMsg(willexecutors):
msg = "Broadcasting Transactions to Will-Executors:\n" msg = "Broadcasting Transactions to Will-Executors:\n"
@@ -2060,14 +2073,18 @@ class BalBuildWillDialog(BalDialog):
parent = bal_window.window parent = bal_window.window
BalDialog.__init__(self, parent, bal_window.bal_plugin, _("Building Will")) BalDialog.__init__(self, parent, bal_window.bal_plugin, _("Building Will"))
self.parent = parent self.parent = parent
self.updatemessage.connect(self.update) self.updatemessage.connect(self.msg_update)
self.bal_window = bal_window self.bal_window = bal_window
self.bal_plugin = bal_window.bal_plugin self.bal_plugin = bal_window.bal_plugin
self.message_label = QLabel(_("Building Will:")) self.message_label = QLabel(_("Building Will:"))
self.vbox = QVBoxLayout(self) self.vbox = QVBoxLayout(self)
self.vbox.addWidget(self.message_label) self.vbox.addWidget(self.message_label,0)
self.qwidget = QWidget() self.qwidget = QWidget(self)
self.vbox.addWidget(self.qwidget) self.vbox.addWidget(self.qwidget,1)
self.labelsbox=QVBoxLayout(self.qwidget)
self.setMinimumWidth(600)
self.setMinimumHeight(100)
self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
self.labels = [] self.labels = []
self.check_row = None self.check_row = None
self.inval_row = None self.inval_row = None
@@ -2344,9 +2361,9 @@ class BalBuildWillDialog(BalDialog):
def on_success_phase1(self, result): def on_success_phase1(self, result):
self.have_to_sign, tx = list(result) self.have_to_sign, tx = list(result)
if not tx: #if not tx:
self.msg_edit_row(self.msg_error("Error, no tx was built")) # self.msg_edit_row(self.msg_error("Error, no tx was built"))
return # return
_logger.debug("have to sign {}".format(self.have_to_sign)) _logger.debug("have to sign {}".format(self.have_to_sign))
password = None password = None
if self.have_to_sign is None: if self.have_to_sign is None:
@@ -2438,7 +2455,10 @@ class BalBuildWillDialog(BalDialog):
_logger.error(f"error phase1: {b}") _logger.error(f"error phase1: {b}")
def on_error_phase2(self, error): def on_error_phase2(self, error):
_logger.error(f"error phase2: { error}") self.bal_window.upade_all()
a,b,c = error
self.msg_edit_row(self.msg_error(f"Error: {b}"))
_logger.error(f"error phase2: {b}")
def msg_set_checking(self, status="Waiting", row=None): def msg_set_checking(self, status="Waiting", row=None):
row = self.check_row if row is None else row row = self.check_row if row is None else row
@@ -2490,10 +2510,11 @@ class BalBuildWillDialog(BalDialog):
def msg_edit_row(self, line, row=None): def msg_edit_row(self, line, row=None):
try: try:
self.labels[row] = line self.labels[row] = line
except Exception: except Exception as e:
self.labels.append(line) self.labels.append(line)
row = len(self.labels) - 1 row = len(self.labels) - 1
self.updatemessage.emit() self.updatemessage.emit()
return row return row
@@ -2505,13 +2526,22 @@ class BalBuildWillDialog(BalDialog):
pass pass
self.updatemessage.emit() self.updatemessage.emit()
def update(self): def clear_layout(self,layout):
self.vbox.removeWidget(self.qwidget) while layout.count():
self.qwidget = QWidget(self) item = layout.takeAt(0)
labelsbox = QVBoxLayout(self.qwidget) w = item.widget()
if w:
w.setParent(None)
w.deleteLater()
def msg_update(self):
self.clear_layout(self.labelsbox)
for label in self.labels: for label in self.labels:
labelsbox.addWidget(QLabel(label)) label=label.replace("\n","<br>")
self.vbox.addWidget(self.qwidget) qlabel=QLabel(label)
self.labelsbox.addWidget(QLabel(label),1)
self.setMinimumHeight(30*(len(self.labels)+2))
def get_text(self): def get_text(self):
return self.message_label.text() return self.message_label.text()

View File

@@ -295,7 +295,6 @@ class Willexecutors:
return {} return {}
def check_transaction(txid, url): def check_transaction(txid, url):
print("check transaction", txid,url)
_logger.debug(f"{url}:{txid}") _logger.debug(f"{url}:{txid}")
try: try:
w = Willexecutors.send_request( w = Willexecutors.send_request(