Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty scripthash, all notifications #1074

Merged
merged 4 commits into from
Aug 30, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions neo/SmartContract/InteropService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<NotifyEventArgs> 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());
Expand Down