Bob refunds swap after restart that requires communication

As Bob is dialing Alice, we now ensure that we are connected to Alice
at each step that needs communication.
If we are not connected, we proceed with dialing.

In an attempt to improve libp2p usage, we also add known address of
Alice first and only use peer_id to dial.
This ensures that we use the expected peer id.
This commit is contained in:
Franck Royer 2020-12-18 17:39:04 +11:00
parent d9ea7ab605
commit 1a4bd0e2b4
No known key found for this signature in database
GPG key ID: A82ED75A8DFC50A4
14 changed files with 347 additions and 72 deletions

View file

@ -1,4 +1,4 @@
use libp2p::core::Multiaddr;
use libp2p::{core::Multiaddr, PeerId};
use url::Url;
use uuid::Uuid;
@ -47,6 +47,9 @@ pub enum Command {
receive_bitcoin: bitcoin::Amount,
},
BuyXmr {
#[structopt(short = "p", long = "connect-peer-id")]
alice_peer_id: PeerId,
#[structopt(short = "a", long = "connect-addr")]
alice_addr: Multiaddr,
@ -78,6 +81,12 @@ pub enum Command {
#[structopt(short = "id", long = "swap-id")]
swap_id: Uuid,
#[structopt(short = "p", long = "connect-peer-id")]
alice_peer_id: PeerId,
#[structopt(short = "a", long = "connect-addr")]
alice_addr: Multiaddr,
#[structopt(
short = "b",
long = "bitcoind-rpc",