We need this on the maker side to be able to get stats on what takers do.
For the taker it will also become relevant in the future so it is not wrong to add it.
If we don't receive a message from BitMex within 5 seconds, we ping
them to let them know that we are still using this connection. This
avoids the constant dis/reconnects that we have been seeing.
To make boot-up of the system easier, we want allow for a state where
we do not yet have a quote available.
Allow the quote in the projection to be optional and fallback to `None`
for profit calculation.
In case we fail to calculate the profit or this data is otherwise not
available, we still want to display as much as possible and only
blank out the data we cannot compute.
BDK's database only acts as a cache and can always be fully restored
by deleting it. With an Electrum backend, syncing is very quick meaning
the local cache basically does not serve any purpose. We've been having
troubles with BDK's database being broken due to internal inconsistency
problems. Switching to an in-memory database should fix these because
a restart of the application essentially wipes the database.
Resolves#465.
Implying `Sync` as part of withdraw allows us to remove the `Sync`
from the startup of the application which avoids an error case in
case we cannot find a particular transaction.
In case the wallet sync fails, we replace the value with `None` to
indicate to the UI that we don't have an up-to-date wallet information.
In case the sync works again at some point, we will replace it with
`Some` again.
Making this optional also allows us to start up the system without
syncing the wallet, a step towards https://github.com/itchysats/itchysats/discussions/753.
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