Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Stop monitoring once a CFD is closed #276

Closed
da-kami opened this issue Oct 11, 2021 · 1 comment
Closed

Stop monitoring once a CFD is closed #276

da-kami opened this issue Oct 11, 2021 · 1 comment

Comments

@da-kami
Copy link
Contributor

da-kami commented Oct 11, 2021

Once a CFD is was closed we should stop monitoring for any transactions related to this CFD.

We should be able to achieve this quite easily by:

  • Add some functionality to btsieve to "un-monitor", i.e. remove scripts by txid from the awaiting_status state.
  • Upon closing the CFD we send a message to the monitor to stop monitoring.

⬅️ original description. The original description of this ticket read a bit different, but I think it is simpler to just remove all monitoring upon closing a CFD. At the moment we don't remove "competing" transactions from monitoring when we reach a final state. This means, when a final transaction (e.g. a CET) reaches finality we will still monitor for other transactions (e.g. refund_tx) that can actually not happen anymore. For `CETs` and `refund_tx` this is most relevant, because they have the same script. Since we only fetch by script from Electrum we will always receive both (and then match them by `Txid`+`Script`).

When reaching finality of a final tx (CET, refund_tx, collaborate_close_tx) we have to remove the remaining "competing" transactions.

Note, that removing the competing transactions is not critical, but when fetching GetHistoryRes by script we can have entries that we don't care about anymore. We might see other weird side effect which should be limited to logs (because we have guards in place to not allow state transitions when in a final state).

See this Todo in monitor.rs :

https://github.com/comit-network/hermes/blob/8d0390156598dc0d38eee5d34e47daf8bc74f616/daemon/src/monitor.rs#L386-L390

and the related section here, where the None path represents the case where we don't care about a transaction-id anymore but still fetched transactions that have that particular script:

https://github.com/comit-network/hermes/blob/8d0390156598dc0d38eee5d34e47daf8bc74f616/daemon/src/monitor.rs#L281-L297

@da-kami da-kami mentioned this issue Oct 11, 2021
@da-kami da-kami changed the title Handle final states in the monitor actor Stop monitoring once a CFD is final Oct 5, 2022
@da-kami da-kami changed the title Stop monitoring once a CFD is final Stop monitoring once a CFD is closed Oct 5, 2022
@bonomat
Copy link
Collaborator

bonomat commented Sep 12, 2023

This project is unmaintained

@bonomat bonomat closed this as not planned Won't fix, can't repro, duplicate, stale Sep 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants