From 4bafc337368e112c0e439a9c7b8f78ab11be4539 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Fri, 8 Nov 2024 14:03:00 +1300 Subject: [PATCH] fix optional --- Blockchain/Sources/Blockchain/State/StateLayer.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Blockchain/Sources/Blockchain/State/StateLayer.swift b/Blockchain/Sources/Blockchain/State/StateLayer.swift index 6742dd45..6031e569 100644 --- a/Blockchain/Sources/Blockchain/State/StateLayer.swift +++ b/Blockchain/Sources/Blockchain/State/StateLayer.swift @@ -172,7 +172,7 @@ public struct StateLayer: @unchecked Sendable { // δ: The (prior) state of the service accounts. public subscript(serviceAccount index: ServiceIndex) -> StateKeys.ServiceAccountKey.Value? { get { - changes[StateKeys.ServiceAccountKey(index: index)]!.value()! + changes[StateKeys.ServiceAccountKey(index: index)]?.value() } set { changes[StateKeys.ServiceAccountKey(index: index)] = .init(newValue) @@ -182,7 +182,7 @@ public struct StateLayer: @unchecked Sendable { // s public subscript(serviceAccount index: ServiceIndex, storageKey key: Data32) -> StateKeys.ServiceAccountStorageKey.Value? { get { - changes[StateKeys.ServiceAccountStorageKey(index: index, key: key)]!.value()! + changes[StateKeys.ServiceAccountStorageKey(index: index, key: key)]?.value() } set { changes[StateKeys.ServiceAccountStorageKey(index: index, key: key)] = .init(newValue) @@ -194,7 +194,7 @@ public struct StateLayer: @unchecked Sendable { serviceAccount index: ServiceIndex, preimageHash hash: Data32 ) -> StateKeys.ServiceAccountPreimagesKey.Value? { get { - changes[StateKeys.ServiceAccountPreimagesKey(index: index, hash: hash)]!.value()! + changes[StateKeys.ServiceAccountPreimagesKey(index: index, hash: hash)]?.value() } set { changes[StateKeys.ServiceAccountPreimagesKey(index: index, hash: hash)] = .init(newValue)