mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-05-02 14:56:10 -04:00
Drive swarm in seperate async task
Previously the libp2p swarm had to be manually polled within the protocol execution code to execute actions such as sending a message. The swarm is now wrapped in SwarmDriver which polls the swarm in a seperate task
This commit is contained in:
parent
f88ed9183b
commit
6f7408ecce
10 changed files with 366 additions and 128 deletions
|
@ -43,6 +43,7 @@ mod message1;
|
|||
mod message2;
|
||||
mod message3;
|
||||
pub mod swap;
|
||||
pub mod swarm_driver;
|
||||
|
||||
pub async fn swap(
|
||||
bitcoin_wallet: Arc<bitcoin::Wallet>,
|
||||
|
@ -117,7 +118,7 @@ pub async fn swap(
|
|||
OutEvent::ConnectionEstablished(bob) => {
|
||||
info!("Connection established with: {}", bob);
|
||||
}
|
||||
OutEvent::Request(amounts::OutEvent::Btc { btc, channel }) => {
|
||||
OutEvent::Request(amounts::OutEvent { btc, channel }) => {
|
||||
let amounts = calculate_amounts(btc);
|
||||
last_amounts = Some(amounts);
|
||||
swarm.send_amounts(channel, amounts);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue