diff --git a/neo.UnitTests/SmartContract/UT_InteropService.cs b/neo.UnitTests/SmartContract/UT_InteropService.cs index 39687fd720..6a33a32abc 100644 --- a/neo.UnitTests/SmartContract/UT_InteropService.cs +++ b/neo.UnitTests/SmartContract/UT_InteropService.cs @@ -85,7 +85,7 @@ public void Runtime_GetNotifications_Test() // Receive all notifications - script.EmitPush(UInt160.Zero.ToArray()); + script.EmitPush(new byte[0]); script.EmitSysCall(InteropService.System_Runtime_GetNotifications); // Execute diff --git a/neo/SmartContract/InteropService.cs b/neo/SmartContract/InteropService.cs index 6868da1886..7aa7fd7284 100644 --- a/neo/SmartContract/InteropService.cs +++ b/neo/SmartContract/InteropService.cs @@ -236,13 +236,15 @@ private static bool Runtime_Serialize(ApplicationEngine engine) private static bool Runtime_GetNotifications(ApplicationEngine engine) { - var data = engine.CurrentContext.EvaluationStack.Pop().GetByteArray(); - if (data.Length != UInt160.Length) return false; + byte[] data = engine.CurrentContext.EvaluationStack.Pop().GetByteArray(); + if ((data.Length != 0) && (data.Length != UInt160.Length)) return false; - var hash = new UInt160(data); IEnumerable notifications = engine.Notifications; - if (!hash.Equals(UInt160.Zero)) + if (data.Length == UInt160.Length) // must filter by scriptHash + { + var hash = new UInt160(data); notifications = notifications.Where(p => p.ScriptHash == hash); + } if (!engine.CheckArraySize(notifications.Count())) return false; engine.CurrentContext.EvaluationStack.Push(notifications.Select(u => new VM.Types.Array(new StackItem[] { u.ScriptHash.ToArray(), u.State })).ToArray());