Skip to content

Commit

Permalink
Call ReorgRender when it reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee Suho committed Aug 5, 2020
1 parent 519c50e commit 579c8d5
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Libplanet/Blockchain/BlockChain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1310,11 +1310,36 @@ IEnumerable<TxId> GetTxIdsWithRange(BlockChain<T> chain, Block<T> start, Block<T
? branchPoint.Index + 1
: 0;

ReorgRenderBlock(startToRenderIndex);
RenderBlocks(startToRenderIndex);
_logger.Debug($"Render for {nameof(Swap)}() is completed.");
}
}

internal void ReorgRenderBlock(long index)
{
Block<T> block = this[index];
_logger.Debug(
"ReorgRender actions in block {blockIndex}: {block}",
block?.Index,
block);
IReadOnlyList<ActionEvaluation> evaluations = EvaluateActions(block);

foreach (var evaluation in evaluations)
{
if (evaluation.Exception is null)
{
evaluation.Action.ReorgRender(evaluation.InputContext, evaluation.OutputStates);
}
else
{
evaluation.Action.ReorgRenderError(
evaluation.InputContext,
evaluation.Exception);
}
}
}

internal IImmutableSet<TxId> GetStagedTransactionIds()
{
_rwlock.EnterReadLock();
Expand Down

0 comments on commit 579c8d5

Please sign in to comment.