Add state0 -> state1 messages

This commit is contained in:
Tobin C. Harding 2020-10-21 14:41:50 +11:00
parent f22729c5da
commit e7504de76c
12 changed files with 559 additions and 98 deletions

View file

@ -9,6 +9,9 @@ pub mod network;
pub const ONE_BTC: u64 = 100_000_000;
const REFUND_TIMELOCK: u32 = 10; // FIXME: What should this be?
const PUNISH_TIMELOCK: u32 = 20; // FIXME: What should this be?
pub type Never = std::convert::Infallible;
/// Commands sent from Bob to the main task.
@ -29,13 +32,19 @@ pub enum Rsp {
pub struct SwapParams {
/// Amount of BTC to swap.
#[serde(with = "::bitcoin::util::amount::serde::as_sat")]
pub btc: bitcoin::Amount,
pub btc: ::bitcoin::Amount,
/// Amount of XMR to swap.
pub xmr: monero::Amount,
#[serde(with = "crate::monero::amount_serde")]
pub xmr: xmr_btc::monero::Amount,
}
impl Display for SwapParams {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{} for {}", self.btc, self.xmr)
write!(
f,
"{} sats for {} piconeros",
self.btc.as_sat(),
self.xmr.as_piconero()
)
}
}