From f9f77894ae9d91e0362b077ae7941b3b6978ebfd Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 4 Dec 2024 09:49:44 -0800 Subject: [PATCH] feat: Add JSON serialization to ChainState --- sia/src/consensus.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sia/src/consensus.rs b/sia/src/consensus.rs index 33e3f42..537736b 100644 --- a/sia/src/consensus.rs +++ b/sia/src/consensus.rs @@ -436,7 +436,7 @@ impl SiaDecodable for State { /// ChainState contains the network parameters and the state of the chain. /// It is used to determine the consensus rules in effect for a particular block. -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Debug, Serialize, Deserialize)] pub struct ChainState { pub network: Network, pub state: State, @@ -445,7 +445,7 @@ pub struct ChainState { impl ChainState { /// child_height returns the height of the next block pub fn child_height(&self) -> u64 { - self.state.index.height + 1 + self.state.index.child_height() } /// block_reward returns the reward for mining a child block