This should prevent accidential double-spends of our own inputs
when doing concurrent contract setups or other interactions of the
wallet.
We only store these in-memory, thus a simple restart of the application
will "unlock" a UTXO in case it was previously marked used but the
transaction never made it to the blockchain for whatever reason.
Resolves#790.
We don't need to `Clone` the wallet actor ever so we can remove this
custom derive which allows us to also drop the `Arc<Mutex>` of the
`bdk::Wallet`, thus simplifying all of the handlers quite a bit.
We also add `&mut` to all handlers. Even though not strictly necessary
(because they are processed by `xtra-productivity`), it is more correct
to write `&mut self` because that is what the macro will output anyway.
The clippy version included with 1.57 flagged several problems:
1. Multiple fields were never read, removed those.
2. The `Default` impl on `Tasks` could be derived.
3. A redundant closure
4. A large enum variant
- Remove dummy transaction and txid (use the transactions received in the
messages instead
- extract helpers for quote and price to prevent misalignments in tests
- extend contract setup to finish at Open state of the cfd
Once these messages are handled by dedicated actors, this will reduce
the amount to runtime errors a la "this message should be handled by
someone else".
See #696.
Instead of passing the whole HashMap to the projection actor, only send what has
actually changed.
Provide separate messages to update settlement proposal and roll over proposals,
as they will be sent from different actors.
```
2021-11-30 16:39:33 INFO daemon::logger: Initialized logger
2021-11-30 16:39:33 INFO taker: Running version: 0.1.2-11-g09cfe03
```
instead of
```
2021-11-30 14:33:14 INFO Initialized logger
2021-11-30 14:33:14 INFO Running version: 0.1.1-367-gcbc42b6
```
Makes it way easier to interpret logs because we have context who logged what.
Move the logic of creating Cfd representation suitable for UI into the
projection actor
For the time being, keep the logic as free functions that are still used in the
"old" way (inside ToSseEvent)
This is to avoid going on chain in a scenario where one party finished the rollover, while the other party ran into a timeout after send-/receiving the last message for the revoke-commit.
This is to avoid going on chain in a scenario where one party sent the signed lock transaction, but did not get the signed transaction from the other party before running into the timeout.
With this solution, we fail the setup (on either side) if we don't receive an acknowledgment message at the end of the setup.
The acknoledge message is a temporary fix.
Once we add monitoring for incomplete DLCs (special case of contract-setup / rollover / collaborative-settlement failing) the ack message should be removed.
As we do not process messages concurrently, heartbeat messages are not processed
during lengthy operations, such as contract setup.
The spam in the amount of commit messages is a bit unfortunate, but only failing
tests on various machines can indicate that the timing might cause issues.
Contract setup test keeps failing when bors runs it.
Note: contract setup got recently refactored into a dedicated actor, this might
have increased the time it takes to finish the process.