From f22729c5dac7dfa9cc09a0a58dfd48a95c5dc18d Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 21 Oct 2020 15:02:37 +1100 Subject: [PATCH] Derive Clone/ on initial states and messages --- xmr-btc/src/alice.rs | 4 ++-- xmr-btc/src/alice/message.rs | 6 +++--- xmr-btc/src/bob.rs | 4 ++-- xmr-btc/src/bob/message.rs | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/xmr-btc/src/alice.rs b/xmr-btc/src/alice.rs index a8a1ea20..62d6385f 100644 --- a/xmr-btc/src/alice.rs +++ b/xmr-btc/src/alice.rs @@ -129,7 +129,7 @@ impl State { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct State0 { a: bitcoin::SecretKey, s_a: cross_curve_dleq::Scalar, @@ -215,7 +215,7 @@ impl State0 { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct State1 { a: bitcoin::SecretKey, B: bitcoin::PublicKey, diff --git a/xmr-btc/src/alice/message.rs b/xmr-btc/src/alice/message.rs index 7c95604b..052731b1 100644 --- a/xmr-btc/src/alice/message.rs +++ b/xmr-btc/src/alice/message.rs @@ -11,7 +11,7 @@ pub enum Message { Message2(Message2), } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct Message0 { pub(crate) A: bitcoin::PublicKey, pub(crate) S_a_monero: monero::PublicKey, @@ -22,13 +22,13 @@ pub struct Message0 { pub(crate) punish_address: bitcoin::Address, } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct Message1 { pub(crate) tx_cancel_sig: Signature, pub(crate) tx_refund_encsig: EncryptedSignature, } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct Message2 { pub(crate) tx_lock_proof: monero::TransferProof, } diff --git a/xmr-btc/src/bob.rs b/xmr-btc/src/bob.rs index 55099ed6..2087a142 100644 --- a/xmr-btc/src/bob.rs +++ b/xmr-btc/src/bob.rs @@ -102,7 +102,7 @@ impl_from_child_enum!(State3, State); impl_from_child_enum!(State4, State); impl_from_child_enum!(State5, State); -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct State0 { b: bitcoin::SecretKey, s_b: cross_curve_dleq::Scalar, @@ -190,7 +190,7 @@ impl State0 { } } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct State1 { A: bitcoin::PublicKey, b: bitcoin::SecretKey, diff --git a/xmr-btc/src/bob/message.rs b/xmr-btc/src/bob/message.rs index de02b7a5..f45c3b92 100644 --- a/xmr-btc/src/bob/message.rs +++ b/xmr-btc/src/bob/message.rs @@ -3,7 +3,7 @@ use anyhow::Result; use ecdsa_fun::{adaptor::EncryptedSignature, Signature}; use std::convert::TryFrom; -#[derive(Debug)] +#[derive(Clone, Debug)] pub enum Message { Message0(Message0), Message1(Message1), @@ -11,7 +11,7 @@ pub enum Message { Message3(Message3), } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct Message0 { pub(crate) B: bitcoin::PublicKey, pub(crate) S_b_monero: monero::PublicKey, @@ -21,18 +21,18 @@ pub struct Message0 { pub(crate) refund_address: bitcoin::Address, } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct Message1 { pub(crate) tx_lock: bitcoin::TxLock, } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct Message2 { pub(crate) tx_punish_sig: Signature, pub(crate) tx_cancel_sig: Signature, } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct Message3 { pub(crate) tx_redeem_encsig: EncryptedSignature, }