Skip to content

Commit

Permalink
add display format
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Apr 1, 2024
1 parent fa5e002 commit f3373a1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/consensus.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
use std::fmt;

pub struct ChainIndex {
pub height: u64,
pub id: [u8; 32],
}

impl fmt::Display for ChainIndex {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}:{}", self.height, hex::encode(&self.id))
}
}

0 comments on commit f3373a1

Please sign in to comment.