From 080633254307771f8aba5f08e7090a0534d1b241 Mon Sep 17 00:00:00 2001 From: svatantrya Date: Sat, 1 Aug 2026 23:33:52 -0400 Subject: [PATCH] core: replace debug print() with _logger, drop dead print_transaction helper --- bal/core/heirs.py | 36 +----------------------------------- bal/core/will.py | 6 +++--- bal/gui/qt/dialogs.py | 1 - 3 files changed, 4 insertions(+), 39 deletions(-) diff --git a/bal/core/heirs.py b/bal/core/heirs.py index 809fc36..31df416 100644 --- a/bal/core/heirs.py +++ b/bal/core/heirs.py @@ -277,7 +277,7 @@ def get_utxos_from_inputs(tx_inputs, tx, utxos): # TODO calculate de minimum inputs to be invalidated def invalidate_inheritance_transactions(wallet): - print("invalidate tx in heir method") + _logger.debug("invalidate tx in heir method") # listids = [] utxos = {} dtxs = {} @@ -312,40 +312,6 @@ def invalidate_inheritance_transactions(wallet): remaining[key] = value -def print_transaction(heirs, tx, locktimes, tx_fees): - jtx = tx.to_json() - print(f"TX: {tx.txid()}\t-\tLocktime: {jtx['locktime']}") - print("---") - for inp in jtx["inputs"]: - print(f"{inp['address']}: {inp['value_sats']}") - print("---") - for out in jtx["outputs"]: - heirname = "" - for key in heirs.keys(): - heir = heirs[key] - out_address = out.get("address", "OP_RETURN") - if heir[HEIR_ADDRESS] == out_address and str(heir[HEIR_LOCKTIME]) == str( - jtx["locktime"] - ): - heirname = key - print(f"{heirname}\t{out.get('address', 'OP_RETURN')}: {out['value_sats']}") - - print() - size = tx.estimated_size() - print( - "fee: {}\texpected: {}\tsize: {}".format( - tx.input_value() - tx.output_value(), size * tx_fees, size - ) - ) - - print() - try: - print(tx.serialize_to_network()) - except Exception: - print("impossible to serialize") - print() - - def get_change_output(wallet, in_amount, out_amount, fee): change_amount = int(in_amount - out_amount - fee) if change_amount > wallet.dust_threshold(): diff --git a/bal/core/will.py b/bal/core/will.py index ea3d3aa..e9322aa 100644 --- a/bal/core/will.py +++ b/bal/core/will.py @@ -455,7 +455,7 @@ class Will: @staticmethod def invalidate_will(will, wallet, fees_per_byte, history_label=None, will_locktime=None): - print("invalidate tx in will module") + _logger.debug("invalidate tx in will module") will_only_valid = Will.only_valid_list(will) inputs = Will.get_all_inputs(will_only_valid) if history_label is not None and will_locktime is not None: @@ -475,13 +475,13 @@ class Will: utxo_to_spend = [] for utxo in utxos: if utxo.is_coinbase_output() and utxo.block_height < current_height+100: - print("is not mature coinbase output") + _logger.debug("is not mature coinbase output") continue utxo_str = utxo.prevout.to_str() if utxo_str in prevout_to_spend: balance += inputs[utxo_str][0][2].value_sats() utxo_to_spend.append(utxo) - print("utxo to spend",utxo_to_spend) + _logger.debug("utxo to spend: {}".format(utxo_to_spend)) if len(utxo_to_spend) > 0: change_addresses = wallet.get_change_addresses_for_new_transaction() out = PartialTxOutput.from_address_and_value(change_addresses[0], balance) diff --git a/bal/gui/qt/dialogs.py b/bal/gui/qt/dialogs.py index 066915f..ad6d165 100644 --- a/bal/gui/qt/dialogs.py +++ b/bal/gui/qt/dialogs.py @@ -1282,7 +1282,6 @@ class BalBuildWillDialog(BalDialog): def invalidate_task(self, password, bal_window, tx): if self._stopping: return - print("invalidate task") _logger.debug(f"invalidate tx: {tx}") # fee_per_byte = bal_window.will_settings.get("baltx_fees", 1) tx = self.bal_window.wallet.sign_transaction(tx, password)