1
0

lnwatcher: fix tx replacement and notifications

- revert the logic of do_breach_remedy to what it was
   before 0ca3d66d15,
   but now calling self.maybe_redeem unconditionally.
 - replace mempool transactions only if the fee increases
 - do not notify the GUI if a local tx is replaced
 - delete labels when replacing
This commit is contained in:
ThomasV
2022-06-10 16:00:30 +02:00
parent ffe36e2f56
commit 7d5125c935
4 changed files with 74 additions and 45 deletions

View File

@@ -240,7 +240,7 @@ class AddressSynchronizer(Logger):
def get_transaction(self, txid: str) -> Transaction:
return self.db.get_transaction(txid)
def add_transaction(self, tx: Transaction, *, allow_unrelated=False) -> bool:
def add_transaction(self, tx: Transaction, *, allow_unrelated=False, notify_GUI=True) -> bool:
"""
Returns whether the tx was successfully added to the wallet history.
Note that a transaction may need to be added several times, if our
@@ -335,7 +335,7 @@ class AddressSynchronizer(Logger):
# save
self.db.add_transaction(tx_hash, tx)
self.db.add_num_inputs_to_tx(tx_hash, len(tx.inputs()))
util.trigger_callback('adb_added_tx', self, tx_hash)
util.trigger_callback('adb_added_tx', self, tx_hash, notify_GUI)
return True
def remove_transaction(self, tx_hash: str) -> None: