Decouple ASB/CLI Errors from Error sent over wire

What goes over the wire should not be coupled to the errors being printed.
For the CLI and ASB we introduce a separate error enum that is used for logging.
When sending over the wire the errors are mapped to and from the `network::spot_price::Error`.

As part of Bob-specific spot_price code was moved from the network into bob.
Clearly separation of the network API from bob/alice.
This commit is contained in:
Daniel Karzel 2021-05-05 13:04:55 +10:00
parent 52f648e1de
commit 5aac76598d
No known key found for this signature in database
GPG key ID: 30C3FC2E438ADB6E
9 changed files with 190 additions and 61 deletions

View file

@ -6,6 +6,7 @@ use crate::{monero, tor};
use anyhow::Result;
use libp2p::swarm::{NetworkBehaviour, SwarmBuilder};
use libp2p::{PeerId, Swarm};
use std::fmt::Debug;
pub fn alice<LR>(
seed: &Seed,
@ -16,7 +17,7 @@ pub fn alice<LR>(
resume_only: bool,
) -> Result<Swarm<alice::Behaviour<LR>>>
where
LR: LatestRate + Send + 'static,
LR: LatestRate + Send + 'static + Debug,
{
with_clear_net(
seed,