Skip to content

Commit

Permalink
Apply minor changes from reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
OnedgeLee committed Nov 7, 2023
1 parent f42967f commit d9e17ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
6 changes: 2 additions & 4 deletions Libplanet.Action/State/WorldBaseState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ public WorldBaseState(ITrie trie, IStateStore stateStore)
/// <returns>The list of <see cref="IAccountState"/>s of the given
/// <paramref name="addresses"/>.</returns>
public IReadOnlyList<IAccount> GetAccounts(IReadOnlyList<Address> addresses) =>
GetAccountStateRoot(addresses)
.Zip(addresses, (trie, address) => CreateAccount(trie))
.ToList();
GetAccountStateRoots(addresses).Select(CreateAccount).ToList();

private IReadOnlyList<ITrie> GetAccountStateRoot(IReadOnlyList<Address> addresses)
private IReadOnlyList<ITrie> GetAccountStateRoots(IReadOnlyList<Address> addresses)
{
if (Legacy)
{
Expand Down
12 changes: 6 additions & 6 deletions Libplanet.Tests/Blockchain/BlockChainTest.Append.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,21 +298,21 @@ public void AppendModern()
TestUtils.CreateBlockCommit(_blockChain.Tip));
var commit1 = TestUtils.CreateBlockCommit(block1);
_blockChain.Append(block1, commit1);
var world1 = _blockChain.GetWorldState();
Assert.False(world1.Legacy);
Assert.Equal(
(Text)"foo",
_blockChain.GetWorldState()
.GetAccount(DumbModernAction.DumbModernAddress)
.GetState(address1));
world1.GetAccount(DumbModernAction.DumbModernAddress).GetState(address1));
var block2 = _blockChain.ProposeBlock(
miner,
new[] { tx2 }.ToImmutableList(),
commit1);
_blockChain.Append(block2, TestUtils.CreateBlockCommit(block2));
var world2 = _blockChain.GetWorldState();
Assert.False(world2.Legacy);
Assert.Equal(
(Text)"bar",
_blockChain.GetWorldState()
.GetAccount(DumbModernAction.DumbModernAddress)
.GetState(address2));
world2.GetAccount(DumbModernAction.DumbModernAddress).GetState(address2));
}

[SkippableFact]
Expand Down

0 comments on commit d9e17ac

Please sign in to comment.