From de969823f5d0300161cce48046656d17eb85e999 Mon Sep 17 00:00:00 2001 From: bettybao1209 <1062108372@qq.com> Date: Fri, 13 Mar 2020 15:18:48 +0800 Subject: [PATCH 1/2] no deletion for empty value --- src/neo/SmartContract/InteropService.Storage.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/neo/SmartContract/InteropService.Storage.cs b/src/neo/SmartContract/InteropService.Storage.cs index 3355a5f83c..7cb7032229 100644 --- a/src/neo/SmartContract/InteropService.Storage.cs +++ b/src/neo/SmartContract/InteropService.Storage.cs @@ -4,6 +4,7 @@ using Neo.VM.Types; using System; using System.Linq; +using System.Numerics; namespace Neo.SmartContract { @@ -43,17 +44,10 @@ private static bool PutExInternal(ApplicationEngine engine, StorageContext conte if (engine.Snapshot.Storages.TryGet(skey)?.IsConstant == true) return false; - if (value.Length == 0 && !flags.HasFlag(StorageFlags.Constant)) - { - // If put 'value' is empty (and non-const), we remove it (implicit `Storage.Delete`) - engine.Snapshot.Storages.Delete(skey); - } - else - { - StorageItem item = engine.Snapshot.Storages.GetAndChange(skey, () => new StorageItem()); - item.Value = value; - item.IsConstant = flags.HasFlag(StorageFlags.Constant); - } + StorageItem item = engine.Snapshot.Storages.GetAndChange(skey, () => new StorageItem()); + item.Value = value; + item.IsConstant = flags.HasFlag(StorageFlags.Constant); + return true; } From b7e68ff6739899eb1c4e2af8ca9e596f9b5b40d0 Mon Sep 17 00:00:00 2001 From: bettybao1209 <1062108372@qq.com> Date: Fri, 13 Mar 2020 15:21:33 +0800 Subject: [PATCH 2/2] remove unused namespace --- src/neo/SmartContract/InteropService.Storage.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/neo/SmartContract/InteropService.Storage.cs b/src/neo/SmartContract/InteropService.Storage.cs index 7cb7032229..c527ee99f8 100644 --- a/src/neo/SmartContract/InteropService.Storage.cs +++ b/src/neo/SmartContract/InteropService.Storage.cs @@ -4,7 +4,6 @@ using Neo.VM.Types; using System; using System.Linq; -using System.Numerics; namespace Neo.SmartContract {