Commit Graph

23 Commits

Author SHA1 Message Date
Lucas Soriano del Pino
a37f43a1ba wip: Provide enough funds to both parties
Also use cosntant backoff retry strategy as opposed to exponential
backoff. This is in case retrying several times quickly causes the
retry intervals to become large enough that the test is very slow
and/or the Bitcoin lock transaction expires.

The current problem occurs on the last message i.e. Bob sending
tx_redeem_encsig to Alice. The action is yielded for Bob to do it, but
Alice appears to never receive it (unconfirmed claim, requires more
logging).
2020-10-30 14:07:15 +11:00
Lucas Soriano del Pino
eb6bbe6180 wip: Fix bug where bob was sending two amount request 2020-10-30 14:05:45 +11:00
Lucas Soriano del Pino
ae87c10cae wip: fixed message0 2020-10-30 14:05:45 +11:00
Tobin C. Harding
c464555f5e Enable trace output 2020-10-30 14:04:27 +11:00
Lucas Soriano del Pino
9384b0cf3c [WIP] Swap app e2e test 2020-10-30 14:04:27 +11:00
Lucas Soriano del Pino
9e30bd5151 Generate addresses as late as possible 2020-10-30 14:04:27 +11:00
Lucas Soriano del Pino
3f43581da7 Implement traits Receive{BitcoinRedeemEncsig, TransferProof}
Unfortunately, I had to put the wrap the swarm in Alice's `Network`
struct in an `Arc<Mutex<T>>` in order to be able to use `backoff` to
control the retry mechanism. This is because the stream of events
cannot be turned into a `SharedFuture` (unlike Bob's).

It would be good to find an alternative solution.
2020-10-30 14:03:27 +11:00
Lucas Soriano del Pino
a4e4c27bee Execute Bob's on-chain protocol after handshake
Co-authored-by: Tobin C. Harding <tobin@coblox.tech>
2020-10-30 14:03:27 +11:00
Lucas Soriano del Pino
4ee82a5a2a Execute Alice's on-chain protocol after handshake
Co-authored-by: Tobin C. Harding <tobin@coblox.tech>
2020-10-30 14:00:39 +11:00
Philipp Hoenisch
8811a0a205
Add Tor to main 2020-10-27 15:03:59 +11:00
Tobin C. Harding
b22f265cf3 Send back an empty response to Message2
Alice does not respond with anything when receiving message 2 from Bob. We don't
want to leave Bob's request/response protocol waiting so send an empty response
back.
2020-10-27 10:26:54 +11:00
Tobin C. Harding
194a19cf1d Add todos 2020-10-27 10:26:51 +11:00
Tobin C. Harding
6be5d64c1c Remove stale, ugly, type conversion 2020-10-27 10:26:46 +11:00
Tobin C. Harding
cbccc282ef Send Message2 from Bob to Alice
In order for Alice to complete the handshake she needs to transition to state 3,
for this she needs message 2 from Bob.

Send `bob::Message2` to Alice and transition to `State3` - completing the
handshake.
2020-10-26 14:30:41 +11:00
Tobin C. Harding
6e34f9c978 Use const TIMEOUT instead of an argument 2020-10-22 14:12:49 +11:00
Tobin C. Harding
ad006fae6a Do a bunch of cleanups 2020-10-22 13:35:55 +11:00
Tobin C. Harding
0f17ec076c Add message1 2020-10-22 13:23:12 +11:00
Tobin C. Harding
ad0d8d5713 Emit message0 out of NB (both parties) 2020-10-22 11:04:49 +11:00
Tobin C. Harding
bb94643943 Remove data from message until Message0 impl serde 2020-10-22 09:58:22 +11:00
Tobin C. Harding
e7504de76c Add state0 -> state1 messages 2020-10-21 15:02:52 +11:00
Tobin C. Harding
aaf1363c05 Refine peer tracker and amounts protocol
We model the getting of amounts as a network behaviour even though conceptually
it is a protocol. Refine/refactor the code a bit to make this more obvious.

- Use `Amounts` instead of `Messenger`

We only ever connect to a single peer, update peer tracker to reflect this. This
is a single patch because the handling of the two network behaviours is a
intertwined.

- Only track one peer connection
- Track the peer id and the multiaddr of the counterparty
- Emit an event for connection established on Alice's side as well as Bob's side
2020-10-21 10:11:24 +11:00
Tobin C. Harding
47eaa44f76 Remove unneeded From<Never> impl 2020-10-21 10:11:24 +11:00
Tobin C. Harding
05766d3146 Add swap/
Add a binary crate `swap` that implements two nodes (Alice and Bob). With this
applied we can start up a node for each role and do:

- Bob: Requests current amounts using BTC is input
- Alice: Responds with amounts
- Bob: (mock) get user input to Ok the amounts

... continue with swap (TODO)
2020-10-16 10:05:06 +11:00