Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
greymistcube committed Nov 1, 2023
1 parent 7aa59f7 commit 78b5d09
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions Libplanet.Action/ActionEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ internal IReadOnlyList<ICommittedActionEvaluation>
}

accountTrie = _stateStore.Commit(accountTrie);
worldTrie = worldTrie.Set(kv.Key, new Binary(accountTrie.Hash.ToByteArray()));
worldTrie = worldTrie.Set(kv.Key, new Binary(accountTrie.Hash.ByteArray));
}

worldTrie = _stateStore.Commit(worldTrie);
Expand All @@ -645,8 +645,7 @@ internal IReadOnlyList<ICommittedActionEvaluation>
Stopwatch stopwatch = new Stopwatch();
worldTrie = _stateStore.GetStateRoot(null).Set(
KeyConverters.ToStateKey(ReservedAddresses.LegacyAccount),
new Binary(
worldTrie.Hash.ToByteArray()));
new Binary(worldTrie.Hash.ByteArray));

_logger
.ForContext("Tag", "Metric")
Expand All @@ -668,12 +667,9 @@ internal IImmutableDictionary<KeyBytes, HashDigest<SHA256>?>
foreach (var updatedAddress in evaluation.OutputState.Delta.UpdatedAddresses)
{
var key = KeyConverters.ToStateKey(updatedAddress);
var iValue = worldTrie.Get(new KeyBytes[] { key }).First();
HashDigest<SHA256>? hash = null;
if (iValue is IValue value)
{
hash = new HashDigest<SHA256>(value);
}
HashDigest<SHA256>? hash = worldTrie.Get(key) is { } value
? new HashDigest<SHA256>(value)
: (HashDigest<SHA256>?)null;

result.Add(key, hash);
}
Expand Down

0 comments on commit 78b5d09

Please sign in to comment.