Skip to content

Commit

Permalink
Merge pull request #3840 from greymistcube/chore/fix-evaluate-block
Browse files Browse the repository at this point in the history
🔧 Fixed `BlockChain.EvaluateBlock()`
  • Loading branch information
greymistcube authored Jun 20, 2024
2 parents 1a9ce89 + 9d4b7c3 commit cc268b0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Libplanet/Blockchain/BlockChain.Evaluate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,14 @@ public HashDigest<SHA256> DetermineNextBlockStateRootHash(
/// contains an action that cannot be loaded with <see cref="IActionLoader"/>.</exception>
/// <seealso cref="ValidateBlockPrecededStateRootHash"/>
[Pure]
public IReadOnlyList<ICommittedActionEvaluation> EvaluateBlock(Block block)
=> ActionEvaluator.Evaluate(
block,
Store.GetStateRootHash(block.Hash));
public IReadOnlyList<ICommittedActionEvaluation> EvaluateBlock(Block block) =>
block.ProtocolVersion >= BlockMetadata.SlothProtocolVersion
? ActionEvaluator.Evaluate(
block,
Store.GetStateRootHash(block.Hash))
: ActionEvaluator.Evaluate(
block,
Store.GetStateRootHash(block.PreviousHash));

/// <summary>
/// Evaluates all actions in the <see cref="PreEvaluationBlock.Transactions"/> and
Expand Down

0 comments on commit cc268b0

Please sign in to comment.