From 78b5d09e264f6f619bed891b974f201ad1576f29 Mon Sep 17 00:00:00 2001 From: Say Cheong Date: Wed, 1 Nov 2023 14:23:10 +0900 Subject: [PATCH] Cleanup --- Libplanet.Action/ActionEvaluator.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Libplanet.Action/ActionEvaluator.cs b/Libplanet.Action/ActionEvaluator.cs index 798ee16524c..237a59d631b 100644 --- a/Libplanet.Action/ActionEvaluator.cs +++ b/Libplanet.Action/ActionEvaluator.cs @@ -621,7 +621,7 @@ internal IReadOnlyList } 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); @@ -645,8 +645,7 @@ internal IReadOnlyList 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") @@ -668,12 +667,9 @@ internal IImmutableDictionary?> foreach (var updatedAddress in evaluation.OutputState.Delta.UpdatedAddresses) { var key = KeyConverters.ToStateKey(updatedAddress); - var iValue = worldTrie.Get(new KeyBytes[] { key }).First(); - HashDigest? hash = null; - if (iValue is IValue value) - { - hash = new HashDigest(value); - } + HashDigest? hash = worldTrie.Get(key) is { } value + ? new HashDigest(value) + : (HashDigest?)null; result.Add(key, hash); }