From aa721814ef0860bdbc69602b695470019302968c Mon Sep 17 00:00:00 2001 From: bettybao1209 <1062108372@qq.com> Date: Sat, 18 Jan 2020 16:46:16 +0800 Subject: [PATCH 01/15] fix balance not change for non-transfer tx --- src/RpcNep5Tracker/RpcNep5Tracker.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/RpcNep5Tracker/RpcNep5Tracker.cs b/src/RpcNep5Tracker/RpcNep5Tracker.cs index e89948890..f211befce 100644 --- a/src/RpcNep5Tracker/RpcNep5Tracker.cs +++ b/src/RpcNep5Tracker/RpcNep5Tracker.cs @@ -107,6 +107,8 @@ private void HandleNotification(StoreView snapshot, Transaction transaction, UIn var eventName = stateItems[0].GetString(); if (eventName != "Transfer") return; if (stateItems.Count < 4) return; + if (stateItems[1] is VM.Types.Null) stateItems[1] = null; + if (stateItems[2] is VM.Types.Null) stateItems[2] = null; if (!(stateItems[1] is null) && !(stateItems[1] is VM.Types.ByteArray)) return; @@ -120,17 +122,19 @@ private void HandleNotification(StoreView snapshot, Transaction transaction, UIn byte[] toBytes = stateItems[2]?.GetSpan().ToArray(); if (toBytes?.Length != 20) toBytes = null; if (fromBytes == null && toBytes == null) return; - var from = new UInt160(fromBytes); - var to = new UInt160(toBytes); + var from = UInt160.Zero; + var to = UInt160.Zero; if (fromBytes != null) { + from = new UInt160(fromBytes); var fromKey = new Nep5BalanceKey(from, scriptHash); if (!nep5BalancesChanged.ContainsKey(fromKey)) nep5BalancesChanged.Add(fromKey, new Nep5Balance()); } if (toBytes != null) { + to = new UInt160(toBytes); var toKey = new Nep5BalanceKey(to, scriptHash); if (!nep5BalancesChanged.ContainsKey(toKey)) nep5BalancesChanged.Add(toKey, new Nep5Balance()); } From 504598d286518dd639dbf2edf0834ea486da2ac6 Mon Sep 17 00:00:00 2001 From: bettybao1209 <1062108372@qq.com> Date: Sun, 19 Jan 2020 11:03:30 +0800 Subject: [PATCH 02/15] deal with gas burn seperately --- src/RpcNep5Tracker/RpcNep5Tracker.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/RpcNep5Tracker/RpcNep5Tracker.cs b/src/RpcNep5Tracker/RpcNep5Tracker.cs index f211befce..403d095b5 100644 --- a/src/RpcNep5Tracker/RpcNep5Tracker.cs +++ b/src/RpcNep5Tracker/RpcNep5Tracker.cs @@ -7,6 +7,7 @@ using Neo.Network.P2P.Payloads; using Neo.Persistence; using Neo.SmartContract; +using Neo.SmartContract.Native; using Neo.VM; using Neo.Wallets; using System; @@ -160,6 +161,12 @@ public void OnPersist(StoreView snapshot, IReadOnlyList Date: Tue, 21 Jan 2020 11:45:09 +0800 Subject: [PATCH 03/15] remove conversion to null --- src/RpcNep5Tracker/RpcNep5Tracker.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/RpcNep5Tracker/RpcNep5Tracker.cs b/src/RpcNep5Tracker/RpcNep5Tracker.cs index 403d095b5..9216b24fe 100644 --- a/src/RpcNep5Tracker/RpcNep5Tracker.cs +++ b/src/RpcNep5Tracker/RpcNep5Tracker.cs @@ -108,8 +108,6 @@ private void HandleNotification(StoreView snapshot, Transaction transaction, UIn var eventName = stateItems[0].GetString(); if (eventName != "Transfer") return; if (stateItems.Count < 4) return; - if (stateItems[1] is VM.Types.Null) stateItems[1] = null; - if (stateItems[2] is VM.Types.Null) stateItems[2] = null; if (!(stateItems[1] is null) && !(stateItems[1] is VM.Types.ByteArray)) return; @@ -165,7 +163,7 @@ public void OnPersist(StoreView snapshot, IReadOnlyList Date: Wed, 22 Jan 2020 13:21:46 +0800 Subject: [PATCH 04/15] check stackitem null --- src/RpcNep5Tracker/RpcNep5Tracker.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/RpcNep5Tracker/RpcNep5Tracker.cs b/src/RpcNep5Tracker/RpcNep5Tracker.cs index 9216b24fe..48bd9ac4c 100644 --- a/src/RpcNep5Tracker/RpcNep5Tracker.cs +++ b/src/RpcNep5Tracker/RpcNep5Tracker.cs @@ -109,16 +109,16 @@ private void HandleNotification(StoreView snapshot, Transaction transaction, UIn if (eventName != "Transfer") return; if (stateItems.Count < 4) return; - if (!(stateItems[1] is null) && !(stateItems[1] is VM.Types.ByteArray)) + if (!(stateItems[1].IsNull) && !(stateItems[1] is null) && !(stateItems[1] is VM.Types.ByteArray)) return; - if (!(stateItems[2] is null) && !(stateItems[2] is VM.Types.ByteArray)) + if (!(stateItems[2].IsNull) && !(stateItems[2] is null) && !(stateItems[2] is VM.Types.ByteArray)) return; var amountItem = stateItems[3]; if (!(amountItem is VM.Types.ByteArray || amountItem is VM.Types.Integer)) return; - byte[] fromBytes = stateItems[1]?.GetSpan().ToArray(); + byte[] fromBytes = stateItems[1].IsNull ? null : stateItems[1]?.GetSpan().ToArray(); if (fromBytes?.Length != 20) fromBytes = null; - byte[] toBytes = stateItems[2]?.GetSpan().ToArray(); + byte[] toBytes = stateItems[2].IsNull ? null : stateItems[2]?.GetSpan().ToArray(); if (toBytes?.Length != 20) toBytes = null; if (fromBytes == null && toBytes == null) return; var from = UInt160.Zero; @@ -163,7 +163,7 @@ public void OnPersist(StoreView snapshot, IReadOnlyList Date: Wed, 22 Jan 2020 09:10:49 +0100 Subject: [PATCH 05/15] Fix IsNull --- src/RpcNep5Tracker/RpcNep5Tracker.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/RpcNep5Tracker/RpcNep5Tracker.cs b/src/RpcNep5Tracker/RpcNep5Tracker.cs index 48bd9ac4c..3e506f62c 100644 --- a/src/RpcNep5Tracker/RpcNep5Tracker.cs +++ b/src/RpcNep5Tracker/RpcNep5Tracker.cs @@ -31,7 +31,7 @@ public class RpcNep5Tracker : Plugin, IPersistencePlugin private bool _shouldTrackHistory; private bool _recordNullAddressHistory; private uint _maxResults; - private Neo.IO.Data.LevelDB.Snapshot _levelDbSnapshot; + private Snapshot _levelDbSnapshot; public RpcNep5Tracker() { @@ -98,6 +98,11 @@ private void RecordTransferHistory(StoreView snapshot, UInt160 scriptHash, UInt1 transferIndex++; } + private bool IsNull(VM.Types.StackItem item) + { + return item == null || item.IsNull; + } + private void HandleNotification(StoreView snapshot, Transaction transaction, UInt160 scriptHash, VM.Types.Array stateItems, Dictionary nep5BalancesChanged, ref ushort transferIndex) @@ -109,16 +114,16 @@ private void HandleNotification(StoreView snapshot, Transaction transaction, UIn if (eventName != "Transfer") return; if (stateItems.Count < 4) return; - if (!(stateItems[1].IsNull) && !(stateItems[1] is null) && !(stateItems[1] is VM.Types.ByteArray)) + if (!IsNull(stateItems[1]) && !(stateItems[1] is VM.Types.ByteArray)) return; - if (!(stateItems[2].IsNull) && !(stateItems[2] is null) && !(stateItems[2] is VM.Types.ByteArray)) + if (!IsNull(stateItems[2]) && !(stateItems[2] is VM.Types.ByteArray)) return; var amountItem = stateItems[3]; if (!(amountItem is VM.Types.ByteArray || amountItem is VM.Types.Integer)) return; - byte[] fromBytes = stateItems[1].IsNull ? null : stateItems[1]?.GetSpan().ToArray(); + byte[] fromBytes = IsNull(stateItems[1]) ? null : stateItems[1]?.GetSpan().ToArray(); if (fromBytes?.Length != 20) fromBytes = null; - byte[] toBytes = stateItems[2].IsNull ? null : stateItems[2]?.GetSpan().ToArray(); + byte[] toBytes = IsNull(stateItems[2]) ? null : stateItems[2]?.GetSpan().ToArray(); if (toBytes?.Length != 20) toBytes = null; if (fromBytes == null && toBytes == null) return; var from = UInt160.Zero; From bcfc86f389e4ef1813670bc8ab224b0b01be8fca Mon Sep 17 00:00:00 2001 From: Shargon Date: Wed, 22 Jan 2020 09:12:50 +0100 Subject: [PATCH 06/15] Remove nullable --- src/RpcNep5Tracker/RpcNep5Tracker.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RpcNep5Tracker/RpcNep5Tracker.cs b/src/RpcNep5Tracker/RpcNep5Tracker.cs index 3e506f62c..fa4280b07 100644 --- a/src/RpcNep5Tracker/RpcNep5Tracker.cs +++ b/src/RpcNep5Tracker/RpcNep5Tracker.cs @@ -121,9 +121,9 @@ private void HandleNotification(StoreView snapshot, Transaction transaction, UIn var amountItem = stateItems[3]; if (!(amountItem is VM.Types.ByteArray || amountItem is VM.Types.Integer)) return; - byte[] fromBytes = IsNull(stateItems[1]) ? null : stateItems[1]?.GetSpan().ToArray(); + byte[] fromBytes = IsNull(stateItems[1]) ? null : stateItems[1].GetSpan().ToArray(); if (fromBytes?.Length != 20) fromBytes = null; - byte[] toBytes = IsNull(stateItems[2]) ? null : stateItems[2]?.GetSpan().ToArray(); + byte[] toBytes = IsNull(stateItems[2]) ? null : stateItems[2].GetSpan().ToArray(); if (toBytes?.Length != 20) toBytes = null; if (fromBytes == null && toBytes == null) return; var from = UInt160.Zero; From 180ea13cf7f5060cd0c5ed0ab0473d6dfc78f308 Mon Sep 17 00:00:00 2001 From: Shargon Date: Wed, 22 Jan 2020 09:14:12 +0100 Subject: [PATCH 07/15] Use constant --- src/RpcNep5Tracker/RpcNep5Tracker.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RpcNep5Tracker/RpcNep5Tracker.cs b/src/RpcNep5Tracker/RpcNep5Tracker.cs index fa4280b07..d5a1e618e 100644 --- a/src/RpcNep5Tracker/RpcNep5Tracker.cs +++ b/src/RpcNep5Tracker/RpcNep5Tracker.cs @@ -122,9 +122,9 @@ private void HandleNotification(StoreView snapshot, Transaction transaction, UIn if (!(amountItem is VM.Types.ByteArray || amountItem is VM.Types.Integer)) return; byte[] fromBytes = IsNull(stateItems[1]) ? null : stateItems[1].GetSpan().ToArray(); - if (fromBytes?.Length != 20) fromBytes = null; + if (fromBytes?.Length != UInt160.Length) fromBytes = null; byte[] toBytes = IsNull(stateItems[2]) ? null : stateItems[2].GetSpan().ToArray(); - if (toBytes?.Length != 20) toBytes = null; + if (toBytes?.Length != UInt160.Length) toBytes = null; if (fromBytes == null && toBytes == null) return; var from = UInt160.Zero; var to = UInt160.Zero; From 28898c698fbf76d349f4040f709d790998ecc592 Mon Sep 17 00:00:00 2001 From: bettybao1209 <1062108372@qq.com> Date: Wed, 22 Jan 2020 21:48:47 +0800 Subject: [PATCH 08/15] PR correction --- src/RpcNep5Tracker/RpcNep5Tracker.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/RpcNep5Tracker/RpcNep5Tracker.cs b/src/RpcNep5Tracker/RpcNep5Tracker.cs index d5a1e618e..82a9600a3 100644 --- a/src/RpcNep5Tracker/RpcNep5Tracker.cs +++ b/src/RpcNep5Tracker/RpcNep5Tracker.cs @@ -98,11 +98,6 @@ private void RecordTransferHistory(StoreView snapshot, UInt160 scriptHash, UInt1 transferIndex++; } - private bool IsNull(VM.Types.StackItem item) - { - return item == null || item.IsNull; - } - private void HandleNotification(StoreView snapshot, Transaction transaction, UInt160 scriptHash, VM.Types.Array stateItems, Dictionary nep5BalancesChanged, ref ushort transferIndex) @@ -114,16 +109,16 @@ private void HandleNotification(StoreView snapshot, Transaction transaction, UIn if (eventName != "Transfer") return; if (stateItems.Count < 4) return; - if (!IsNull(stateItems[1]) && !(stateItems[1] is VM.Types.ByteArray)) + if (!stateItems[1].IsNull && !(stateItems[1] is VM.Types.ByteArray)) return; - if (!IsNull(stateItems[2]) && !(stateItems[2] is VM.Types.ByteArray)) + if (!stateItems[2].IsNull && !(stateItems[2] is VM.Types.ByteArray)) return; var amountItem = stateItems[3]; if (!(amountItem is VM.Types.ByteArray || amountItem is VM.Types.Integer)) return; - byte[] fromBytes = IsNull(stateItems[1]) ? null : stateItems[1].GetSpan().ToArray(); + byte[] fromBytes = stateItems[1].IsNull ? null : stateItems[1].GetSpan().ToArray(); if (fromBytes?.Length != UInt160.Length) fromBytes = null; - byte[] toBytes = IsNull(stateItems[2]) ? null : stateItems[2].GetSpan().ToArray(); + byte[] toBytes = stateItems[2].IsNull ? null : stateItems[2].GetSpan().ToArray(); if (toBytes?.Length != UInt160.Length) toBytes = null; if (fromBytes == null && toBytes == null) return; var from = UInt160.Zero; From 976a197f0511ea9ba494d6e0281717f19f53bb7c Mon Sep 17 00:00:00 2001 From: bettybao1209 <1062108372@qq.com> Date: Wed, 26 Feb 2020 14:11:49 +0800 Subject: [PATCH 09/15] modify check statement --- src/RpcNep5Tracker/RpcNep5Tracker.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RpcNep5Tracker/RpcNep5Tracker.cs b/src/RpcNep5Tracker/RpcNep5Tracker.cs index 9216b24fe..a02a1910a 100644 --- a/src/RpcNep5Tracker/RpcNep5Tracker.cs +++ b/src/RpcNep5Tracker/RpcNep5Tracker.cs @@ -161,9 +161,9 @@ public void OnPersist(StoreView snapshot, IReadOnlyList Date: Wed, 26 Feb 2020 15:30:58 +0800 Subject: [PATCH 10/15] bug ifix --- src/RpcNep5Tracker/RpcNep5Tracker.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/RpcNep5Tracker/RpcNep5Tracker.cs b/src/RpcNep5Tracker/RpcNep5Tracker.cs index 2605a23ff..a352d76be 100644 --- a/src/RpcNep5Tracker/RpcNep5Tracker.cs +++ b/src/RpcNep5Tracker/RpcNep5Tracker.cs @@ -109,16 +109,16 @@ private void HandleNotification(StoreView snapshot, Transaction transaction, UIn if (eventName != "Transfer") return; if (stateItems.Count < 4) return; - if (!stateItems[1].IsNull && !(stateItems[1] is VM.Types.ByteArray)) + if (!(stateItems[1] is null) && !(stateItems[1] is VM.Types.ByteArray)) return; - if (!stateItems[2].IsNull && !(stateItems[2] is VM.Types.ByteArray)) + if (!(stateItems[2] is null) && !(stateItems[2] is VM.Types.ByteArray)) return; var amountItem = stateItems[3]; if (!(amountItem is VM.Types.ByteArray || amountItem is VM.Types.Integer)) return; - byte[] fromBytes = stateItems[1].IsNull ? null : stateItems[1].GetSpan().ToArray(); + byte[] fromBytes = stateItems[1]?.GetSpan().ToArray(); if (fromBytes?.Length != UInt160.Length) fromBytes = null; - byte[] toBytes = stateItems[2].IsNull ? null : stateItems[2].GetSpan().ToArray(); + byte[] toBytes = stateItems[2]?.GetSpan().ToArray(); if (toBytes?.Length != UInt160.Length) toBytes = null; if (fromBytes == null && toBytes == null) return; var from = UInt160.Zero; From c75c0766fc15832fe3cd5edce4c3bb4b68e56253 Mon Sep 17 00:00:00 2001 From: bettybao1209 <1062108372@qq.com> Date: Wed, 26 Feb 2020 16:15:17 +0800 Subject: [PATCH 11/15] send stackitem.null --- src/RpcNep5Tracker/RpcNep5Tracker.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/RpcNep5Tracker/RpcNep5Tracker.cs b/src/RpcNep5Tracker/RpcNep5Tracker.cs index a352d76be..d3dae4c87 100644 --- a/src/RpcNep5Tracker/RpcNep5Tracker.cs +++ b/src/RpcNep5Tracker/RpcNep5Tracker.cs @@ -109,16 +109,16 @@ private void HandleNotification(StoreView snapshot, Transaction transaction, UIn if (eventName != "Transfer") return; if (stateItems.Count < 4) return; - if (!(stateItems[1] is null) && !(stateItems[1] is VM.Types.ByteArray)) + if (!(stateItems[1].IsNull) && !(stateItems[1] is VM.Types.ByteArray)) return; - if (!(stateItems[2] is null) && !(stateItems[2] is VM.Types.ByteArray)) + if (!(stateItems[2].IsNull) && !(stateItems[2] is VM.Types.ByteArray)) return; var amountItem = stateItems[3]; if (!(amountItem is VM.Types.ByteArray || amountItem is VM.Types.Integer)) return; - byte[] fromBytes = stateItems[1]?.GetSpan().ToArray(); + byte[] fromBytes = stateItems[1].IsNull ? null : stateItems[1].GetSpan().ToArray(); if (fromBytes?.Length != UInt160.Length) fromBytes = null; - byte[] toBytes = stateItems[2]?.GetSpan().ToArray(); + byte[] toBytes = stateItems[2].IsNull ? null : stateItems[2].GetSpan().ToArray(); if (toBytes?.Length != UInt160.Length) toBytes = null; if (fromBytes == null && toBytes == null) return; var from = UInt160.Zero; @@ -163,7 +163,7 @@ public void OnPersist(StoreView snapshot, IReadOnlyList Date: Mon, 9 Mar 2020 11:06:54 +0800 Subject: [PATCH 12/15] not tracker non-tx transfer history --- src/RpcNep5Tracker/RpcNep5Tracker.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/RpcNep5Tracker/RpcNep5Tracker.cs b/src/RpcNep5Tracker/RpcNep5Tracker.cs index d3dae4c87..fd768f2c4 100644 --- a/src/RpcNep5Tracker/RpcNep5Tracker.cs +++ b/src/RpcNep5Tracker/RpcNep5Tracker.cs @@ -98,7 +98,7 @@ private void RecordTransferHistory(StoreView snapshot, UInt160 scriptHash, UInt1 transferIndex++; } - private void HandleNotification(StoreView snapshot, Transaction transaction, UInt160 scriptHash, + private void HandleNotification(StoreView snapshot, IVerifiable scriptContainer, UInt160 scriptHash, VM.Types.Array stateItems, Dictionary nep5BalancesChanged, ref ushort transferIndex) { @@ -137,7 +137,8 @@ private void HandleNotification(StoreView snapshot, Transaction transaction, UIn var toKey = new Nep5BalanceKey(to, scriptHash); if (!nep5BalancesChanged.ContainsKey(toKey)) nep5BalancesChanged.Add(toKey, new Nep5Balance()); } - RecordTransferHistory(snapshot, scriptHash, from, to, amountItem.GetBigInteger(), transaction.Hash, ref transferIndex); + if(scriptContainer is Transaction transaction) + RecordTransferHistory(snapshot, scriptHash, from, to, amountItem.GetBigInteger(), transaction.Hash, ref transferIndex); } public void OnPersist(StoreView snapshot, IReadOnlyList applicationExecutedList) @@ -153,18 +154,11 @@ public void OnPersist(StoreView snapshot, IReadOnlyList Date: Mon, 9 Mar 2020 11:15:19 +0800 Subject: [PATCH 13/15] format --- src/RpcNep5Tracker/RpcNep5Tracker.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/RpcNep5Tracker/RpcNep5Tracker.cs b/src/RpcNep5Tracker/RpcNep5Tracker.cs index fd768f2c4..9545749d1 100644 --- a/src/RpcNep5Tracker/RpcNep5Tracker.cs +++ b/src/RpcNep5Tracker/RpcNep5Tracker.cs @@ -138,7 +138,9 @@ private void HandleNotification(StoreView snapshot, IVerifiable scriptContainer, if (!nep5BalancesChanged.ContainsKey(toKey)) nep5BalancesChanged.Add(toKey, new Nep5Balance()); } if(scriptContainer is Transaction transaction) + { RecordTransferHistory(snapshot, scriptHash, from, to, amountItem.GetBigInteger(), transaction.Hash, ref transferIndex); + } } public void OnPersist(StoreView snapshot, IReadOnlyList applicationExecutedList) From 273a7cd7e5d76fa6e3ef2e133c2ccc7cb233341e Mon Sep 17 00:00:00 2001 From: bettybao1209 <1062108372@qq.com> Date: Mon, 9 Mar 2020 11:26:32 +0800 Subject: [PATCH 14/15] format --- src/RpcNep5Tracker/RpcNep5Tracker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RpcNep5Tracker/RpcNep5Tracker.cs b/src/RpcNep5Tracker/RpcNep5Tracker.cs index 9545749d1..d283d9c27 100644 --- a/src/RpcNep5Tracker/RpcNep5Tracker.cs +++ b/src/RpcNep5Tracker/RpcNep5Tracker.cs @@ -137,7 +137,7 @@ private void HandleNotification(StoreView snapshot, IVerifiable scriptContainer, var toKey = new Nep5BalanceKey(to, scriptHash); if (!nep5BalancesChanged.ContainsKey(toKey)) nep5BalancesChanged.Add(toKey, new Nep5Balance()); } - if(scriptContainer is Transaction transaction) + if (scriptContainer is Transaction transaction) { RecordTransferHistory(snapshot, scriptHash, from, to, amountItem.GetBigInteger(), transaction.Hash, ref transferIndex); } From 672f0a672cee5db9326289ce752d35f5c21d52f2 Mon Sep 17 00:00:00 2001 From: bettybao1209 <1062108372@qq.com> Date: Mon, 9 Mar 2020 17:49:29 +0800 Subject: [PATCH 15/15] add check for invalid address --- src/RpcNep5Tracker/RpcNep5Tracker.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/RpcNep5Tracker/RpcNep5Tracker.cs b/src/RpcNep5Tracker/RpcNep5Tracker.cs index d283d9c27..d94ab0d60 100644 --- a/src/RpcNep5Tracker/RpcNep5Tracker.cs +++ b/src/RpcNep5Tracker/RpcNep5Tracker.cs @@ -117,9 +117,11 @@ private void HandleNotification(StoreView snapshot, IVerifiable scriptContainer, if (!(amountItem is VM.Types.ByteArray || amountItem is VM.Types.Integer)) return; byte[] fromBytes = stateItems[1].IsNull ? null : stateItems[1].GetSpan().ToArray(); - if (fromBytes?.Length != UInt160.Length) fromBytes = null; + if (fromBytes != null && fromBytes.Length != UInt160.Length) + return; byte[] toBytes = stateItems[2].IsNull ? null : stateItems[2].GetSpan().ToArray(); - if (toBytes?.Length != UInt160.Length) toBytes = null; + if (toBytes != null && toBytes.Length != UInt160.Length) + return; if (fromBytes == null && toBytes == null) return; var from = UInt160.Zero; var to = UInt160.Zero;