Skip to content

Commit

Permalink
Merge pull request #75 from SiaFoundation/nate/serialize-chain-state
Browse files Browse the repository at this point in the history
feat: Add JSON serialization to ChainState
  • Loading branch information
lukechampine authored Dec 5, 2024
2 parents d35153c + f9f7789 commit d6ecc19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sia/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit d6ecc19

Please sign in to comment.