Cleanup swap initialization for Alice and Bob

This commit is contained in:
Daniel Karzel 2021-03-03 13:17:09 +11:00
parent a8ebd4d16e
commit 1b167f3eb6
6 changed files with 72 additions and 281 deletions

View file

@ -36,6 +36,15 @@ impl Display for Swap {
}
}
impl Swap {
pub fn try_into_bob(self) -> Result<Bob> {
match self {
Swap::Bob(bob) => Ok(bob),
Swap::Alice(_) => bail!("Swap instance is not Bob"),
}
}
}
pub struct Database(sled::Db);
impl Database {