Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Swen Mun <longfinfunnel@gmail.com>
  • Loading branch information
kfangw and longfin committed Jul 1, 2021
1 parent af539df commit 60e260c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Libplanet.Extensions.Cocona/Commands/StoreCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ private static IEnumerable<Block<T>> IterateBlocks<T>(IStore store, TxId txId)
{
foreach (var blockHash in store.IterateTxIdBlockHashIndex(txId))
{
var block = GetBlock<T>(store, blockHash);
yield return block;
yield return GetBlock<T>(store, blockHash);
}
}

Expand All @@ -186,7 +185,7 @@ private static IEnumerable<int> BuildTxIdBlockHashIndex(IStore store, int offset
}

var index = offset;
foreach (var blockHash in store.IterateIndexes(chainId, offset, limit))
foreach (BlockHash blockHash in store.IterateIndexes(chainId, offset, limit))
{
yield return index++;
if (!(store.GetBlockDigest(blockHash) is { } blockDigest))
Expand All @@ -195,8 +194,7 @@ private static IEnumerable<int> BuildTxIdBlockHashIndex(IStore store, int offset
$"Block is missing for BlockHash: {blockHash} index: {index}.");
}

foreach (var txId in blockDigest.TxIds.Select(bytes => new TxId(bytes.ToArray()))
.ToImmutableArray())
foreach (TxId txId in blockDigest.TxIds.Select(bytes => new TxId(bytes.ToArray())))
{
store.PutTxIdBlockHashIndex(txId, blockHash);
}
Expand Down

0 comments on commit 60e260c

Please sign in to comment.