mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-25 07:29:32 -05:00
Rename bob::Message1 to Message2
As per sequence diagram.
This commit is contained in:
parent
0d1be52966
commit
18f326ddd1
@ -2,7 +2,7 @@ use crate::protocol::{
|
||||
alice,
|
||||
alice::{Message3, TransferProof},
|
||||
bob,
|
||||
bob::{EncryptedSignature, Message4},
|
||||
bob::{EncryptedSignature, Message2, Message4},
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
use futures::prelude::*;
|
||||
@ -27,7 +27,7 @@ pub const BUF_SIZE: usize = 1024 * 1024;
|
||||
pub enum BobToAlice {
|
||||
SwapRequest(Box<bob::SwapRequest>),
|
||||
Message0(Box<bob::Message0>),
|
||||
Message1(Box<bob::Message1>),
|
||||
Message2(Box<Message2>),
|
||||
Message4(Box<Message4>),
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ use crate::{
|
||||
protocol::{
|
||||
alice::{State0, State3},
|
||||
bob,
|
||||
bob::Message4,
|
||||
bob::{Message2, Message4},
|
||||
},
|
||||
};
|
||||
use anyhow::{Context, Error, Result};
|
||||
@ -82,11 +82,11 @@ impl Behaviour {
|
||||
.await?;
|
||||
|
||||
let state2 = {
|
||||
let bob_message1 = serde_cbor::from_slice::<bob::Message1>(
|
||||
let message2 = serde_cbor::from_slice::<Message2>(
|
||||
&substream.read_message(BUF_SIZE).await?,
|
||||
)
|
||||
.context("failed to deserialize message1")?;
|
||||
state1.receive(bob_message1)
|
||||
.context("failed to deserialize message2")?;
|
||||
state1.receive(message2)
|
||||
};
|
||||
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ use crate::{
|
||||
alice,
|
||||
alice::{Message3, TransferProof},
|
||||
bob,
|
||||
bob::{EncryptedSignature, Message4},
|
||||
bob::{EncryptedSignature, Message2, Message4},
|
||||
SwapAmounts,
|
||||
},
|
||||
};
|
||||
@ -197,7 +197,7 @@ pub struct State1 {
|
||||
}
|
||||
|
||||
impl State1 {
|
||||
pub fn receive(self, msg: bob::Message1) -> State2 {
|
||||
pub fn receive(self, msg: Message2) -> State2 {
|
||||
State2 {
|
||||
a: self.a,
|
||||
B: self.B,
|
||||
|
@ -26,7 +26,7 @@ pub use self::{
|
||||
swap::{run, run_until},
|
||||
swap_request::*,
|
||||
};
|
||||
pub use execution_setup::{Message0, Message1, Message4};
|
||||
pub use execution_setup::{Message0, Message2, Message4};
|
||||
|
||||
mod encrypted_signature;
|
||||
pub mod event_loop;
|
||||
|
@ -24,7 +24,7 @@ pub struct Message0 {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct Message1 {
|
||||
pub struct Message2 {
|
||||
pub(crate) tx_lock: crate::bitcoin::TxLock,
|
||||
}
|
||||
|
||||
@ -90,11 +90,11 @@ impl Behaviour {
|
||||
.receive(bitcoin_wallet.as_ref(), alice_message0)
|
||||
.await?;
|
||||
{
|
||||
let bob_message1 = state1.next_message();
|
||||
let message2 = state1.next_message();
|
||||
substream
|
||||
.write_message(
|
||||
&serde_cbor::to_vec(&bob_message1)
|
||||
.context("failed to serialize Message1")?,
|
||||
&serde_cbor::to_vec(&message2)
|
||||
.context("failed to serialize message2")?,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ use crate::{
|
||||
alice,
|
||||
alice::Message3,
|
||||
bob,
|
||||
bob::{EncryptedSignature, Message4},
|
||||
bob::{EncryptedSignature, Message2, Message4},
|
||||
SwapAmounts,
|
||||
},
|
||||
};
|
||||
@ -189,8 +189,8 @@ pub struct State1 {
|
||||
}
|
||||
|
||||
impl State1 {
|
||||
pub fn next_message(&self) -> bob::Message1 {
|
||||
bob::Message1 {
|
||||
pub fn next_message(&self) -> Message2 {
|
||||
Message2 {
|
||||
tx_lock: self.tx_lock.clone(),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user