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

@@ -702,6 +702,7 @@ async fn run<C: Coin, D: Db, Co: Coordinator>(mut raw_db: D, coin: C, mut coordi
info!("created batch {} ({} instructions)", batch.id, batch.instructions.len());
// Start signing this batch
// TODO: Don't reload both sets of keys in full just to get the Substrate public key
tributary_mutable
.substrate_signers
.get_mut(tributary_mutable.key_gen.keys(&key).0.group_key().to_bytes().as_slice())

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 {