The list of transactions can be queried afterwards and it is currently flooding the log files. I may consider putting it back once we have a log parser, but it seems pretty unnecessary.
The sleep flag was used to avoid doing useless work when no data was hold by the tower. However, from the implementation of the data persistence on, the Watcher and Responder should at least keep track of the last known block. The current apporach was making this harder.
- Uses an instance of the Carrier so it can benefit from issued_receipts and avoid resending multiple copies of the same triggered appointment
- Defines last_known_block to properly load data from db
- Uses task_done from Queue to properly signal task completion when boostraping from db
- Creates a checked_txs dict in get_completed_trackers to avoid querying bitcoind for the same transaction over and over
- Redefines completed_trackers as dict instead of tuple
When an appointment was triggered a flag was set in the Watcher, and removed later on in the Responder if the transaction ended up being rejected. That's pretty annoying. Since we have information about whether a transaction has made it to the mempool or not via the Carrier's receipt, this can be all done in the Watcher, which makes more sense and reduces the interaction with the db (1 write if succeeds, 0 otherwise instead of 1 write if succeeds, 2 otherwise).
There was a bug in the Responder where, if a tracker could not be added (e.g. malformed tx) the data was dropped but never removed from the Watcher's db. This is due to flagging appointments as triggered instead of deleting them from the Watcher's db straight away (in order to deal with reorgs in the future).
If that approach is not followed, and appointments are removed from the Watcher's db once they are passed to the Responder, this should be removed since it would be redundant.
Data used to be stored both in memory and disk (db). This commits modifies the Watcher, Responder and Cleaner so they only keep the needed maps and load information from disk when necessary.
ChainMonitor is the actor in charge of checking new blocks. It improves from the previous zmq_subscriber by also doing polling and, therefore, making sure that no blocks are missed.
Documentation and tests are still required. Partially covers #31
get_txs_to_rebroadcast was beinf triggered based on received transactions indstead of stored txs. Fixing that.
Some of the names in the Responder were poorly picked (not descriptibe enough). Tries to fix that.
``Job`` class has been renames to ``TransactionTracker``.
``add_response`` has been renamed to ``handle_breach`` and ``create_job`` to ``add_tracker``.
All the variables that has `job` on it have already been updated.
We were passing some unnecessary parameters to the Cleaner (locator) that could be derived from other data (uuid and appointments). Also standarises the order of the parameters to match the rest of the methods
Updates handle_reorg to work with the current version of the Responder (the old code was outdated and broken).
`check_tx_in_chain` was only used by `handle_reorgs`, and made not much sense at this point. The method need to check if the transaction is in mempool or blockchain, so it seems to make more sense bulding on top of `get_transaction`.
There were a couple of wrong things going on in the `Responder`:
- `check_confirmations` included in 8a10979db0 was not doing a good job keeping track of the missed confirmations, probably due to a overlooked refactor.
- There was an edge case when adding txs to `unconfirmed_txs` on `create_job` that may lead to a transaction being confirmed and unconfirmed at the same time from the `Responder's` pow. It could be triggered by adding two jobs with the same justice_txid.
The difference between master and the old data-persistence branch was huge, seems more effective to manually cherry pick the changes and integrate them
Several changes have been performed:
- Retry counter has been removed (#23)
- Rebroadcast return receipts now
- Re-calling send_transaction if a fixable error occurs should be handled in the responder now (missing)
- Fixes some small bugs