Implement a pretty Debug for various objects

This commit is contained in:
Luke Parker
2023-07-29 03:56:59 -04:00
parent 2641b83b3e
commit 22da7aedde
5 changed files with 65 additions and 6 deletions

View File

@@ -69,13 +69,24 @@ impl<C: Coin> Payment<C> {
}
}
#[derive(Clone, PartialEq, Eq, Debug)]
#[derive(Clone, PartialEq, Eq)]
pub struct Plan<C: Coin> {
pub key: <C::Curve as Ciphersuite>::G,
pub inputs: Vec<C::Output>,
pub payments: Vec<Payment<C>>,
pub change: Option<<C::Curve as Ciphersuite>::G>,
}
impl<C: Coin> core::fmt::Debug for Plan<C> {
fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> {
fmt
.debug_struct("Plan")
.field("key", &hex::encode(self.key.to_bytes()))
.field("inputs", &self.inputs)
.field("payments", &self.payments)
.field("change", &self.change.map(|change| hex::encode(change.to_bytes())))
.finish()
}
}
impl<C: Coin> Plan<C> {
pub fn transcript(&self) -> RecommendedTranscript {