From c7ac4b6dff8e7196ffb730554fa63b112f83e701 Mon Sep 17 00:00:00 2001 From: Vsevolod Brekelov Date: Tue, 26 Nov 2019 18:24:54 +0300 Subject: [PATCH] core: fix encoding and decoding for notification event --- pkg/core/blockchain.go | 2 +- pkg/core/entities/notification_event.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 1dc6dfb78..9228a4c68 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -27,7 +27,7 @@ import ( // Tuning parameters. const ( headerBatchCount = 2000 - version = "0.0.2" + version = "0.0.3" // This one comes from C# code and it's different from the constant used // when creating an asset with Neo.Asset.Create interop call. It looks diff --git a/pkg/core/entities/notification_event.go b/pkg/core/entities/notification_event.go index cf69815b2..47ea291ef 100644 --- a/pkg/core/entities/notification_event.go +++ b/pkg/core/entities/notification_event.go @@ -39,11 +39,19 @@ func (ne *NotificationEvent) DecodeBinary(r *io.BinReader) { // EncodeBinary implements the Serializable interface. func (aer *AppExecResult) EncodeBinary(w *io.BinWriter) { w.WriteBytes(aer.TxHash[:]) + w.WriteLE(aer.Trigger) + w.WriteString(aer.VMState) + w.WriteLE(aer.GasConsumed) + w.WriteString(aer.Stack) w.WriteArray(aer.Events) } // DecodeBinary implements the Serializable interface. func (aer *AppExecResult) DecodeBinary(r *io.BinReader) { r.ReadBytes(aer.TxHash[:]) + r.ReadLE(&aer.Trigger) + aer.VMState = r.ReadString() + r.ReadLE(&aer.GasConsumed) + aer.Stack = r.ReadString() r.ReadArray(&aer.Events) }