Rename alice::Message0 to Message0

There is now only one message0
This commit is contained in:
Franck Royer 2021-02-04 12:05:48 +11:00
parent 88bf080dc0
commit fc2d8d3861
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
4 changed files with 10 additions and 13 deletions

View File

@ -2,7 +2,7 @@ use crate::protocol::{
alice,
alice::{Message1, Message3, TransferProof},
bob,
bob::{EncryptedSignature, Message2, Message4},
bob::{EncryptedSignature, Message0, Message2, Message4},
};
use async_trait::async_trait;
use futures::prelude::*;
@ -26,7 +26,7 @@ pub const BUF_SIZE: usize = 1024 * 1024;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum BobToAlice {
SwapRequest(Box<bob::SwapRequest>),
Message0(Box<bob::Message0>),
Message0(Box<Message0>),
Message2(Box<Message2>),
Message4(Box<Message4>),
}

View File

@ -5,8 +5,7 @@ use crate::{
network::request_response::BUF_SIZE,
protocol::{
alice::{State0, State3},
bob,
bob::{Message2, Message4},
bob::{Message0, Message2, Message4},
},
};
use anyhow::{Context, Error, Result};
@ -67,11 +66,11 @@ impl Behaviour {
let message1 = state0.next_message();
let state1 = {
let bob_message0 = serde_cbor::from_slice::<bob::Message0>(
let message0 = serde_cbor::from_slice::<Message0>(
&substream.read_message(BUF_SIZE).await?,
)
.context("failed to deserialize message0")?;
state0.receive(bob_message0)?
state0.receive(message0)?
};
substream

View File

@ -9,8 +9,7 @@ use crate::{
monero,
protocol::{
alice::{Message1, Message3, TransferProof},
bob,
bob::{EncryptedSignature, Message2, Message4},
bob::{EncryptedSignature, Message0, Message2, Message4},
SwapAmounts,
},
};
@ -148,7 +147,7 @@ impl State0 {
}
}
pub fn receive(self, msg: bob::Message0) -> Result<State1> {
pub fn receive(self, msg: Message0) -> Result<State1> {
msg.dleq_proof_s_b.verify(
msg.S_b_bitcoin.clone().into(),
msg.S_b_monero

View File

@ -11,8 +11,7 @@ use crate::{
monero::{monero_private_key, TransferProof},
protocol::{
alice::{Message1, Message3},
bob,
bob::{EncryptedSignature, Message2, Message4},
bob::{EncryptedSignature, Message0, Message2, Message4},
SwapAmounts,
},
};
@ -119,8 +118,8 @@ impl State0 {
}
}
pub fn next_message(&self) -> bob::Message0 {
bob::Message0 {
pub fn next_message(&self) -> Message0 {
Message0 {
B: self.b.public(),
S_b_monero: monero::PublicKey::from_private_key(&monero::PrivateKey {
scalar: self.s_b.into_ed25519(),