|
|
@ -1,6 +1,6 @@
|
|
|
|
use crate::{
|
|
|
|
use crate::{
|
|
|
|
execution_params::ExecutionParams,
|
|
|
|
execution_params::ExecutionParams,
|
|
|
|
network::{transport::SwapTransport, TokioExecutor},
|
|
|
|
network::{transport, TokioExecutor},
|
|
|
|
protocol::{
|
|
|
|
protocol::{
|
|
|
|
alice::{Behaviour, OutEvent, State0, State3, SwapResponse, TransferProof},
|
|
|
|
alice::{Behaviour, OutEvent, State0, State3, SwapResponse, TransferProof},
|
|
|
|
bob::{EncryptedSignature, SwapRequest},
|
|
|
|
bob::{EncryptedSignature, SwapRequest},
|
|
|
@ -135,11 +135,13 @@ pub struct EventLoop {
|
|
|
|
|
|
|
|
|
|
|
|
impl EventLoop {
|
|
|
|
impl EventLoop {
|
|
|
|
pub fn new(
|
|
|
|
pub fn new(
|
|
|
|
transport: SwapTransport,
|
|
|
|
identity: libp2p::identity::Keypair,
|
|
|
|
behaviour: Behaviour,
|
|
|
|
|
|
|
|
listen: Multiaddr,
|
|
|
|
listen: Multiaddr,
|
|
|
|
peer_id: PeerId,
|
|
|
|
peer_id: PeerId,
|
|
|
|
) -> Result<(Self, EventLoopHandle)> {
|
|
|
|
) -> Result<(Self, EventLoopHandle)> {
|
|
|
|
|
|
|
|
let behaviour = Behaviour::default();
|
|
|
|
|
|
|
|
let transport = transport::build(identity)?;
|
|
|
|
|
|
|
|
|
|
|
|
let mut swarm = libp2p::swarm::SwarmBuilder::new(transport, behaviour, peer_id)
|
|
|
|
let mut swarm = libp2p::swarm::SwarmBuilder::new(transport, behaviour, peer_id)
|
|
|
|
.executor(Box::new(TokioExecutor {
|
|
|
|
.executor(Box::new(TokioExecutor {
|
|
|
|
handle: tokio::runtime::Handle::current(),
|
|
|
|
handle: tokio::runtime::Handle::current(),
|
|
|
|