Skip to content

Commit d1d0921

Browse files
committed
use VMState as marker
1 parent 90c18b7 commit d1d0921

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/core/state/notification_event.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ func (aer *AppExecResult) EncodeBinary(w *io.BinWriter) {
7878
func (aer *AppExecResult) EncodeBinaryWithContext(w *io.BinWriter, sc *stackitem.SerializationContext) {
7979
w.WriteBytes(aer.Container[:])
8080
w.WriteB(byte(aer.Trigger))
81+
invocLen := len(aer.Invocations)
82+
if invocLen > 0 {
83+
aer.VMState |= 0x80
84+
}
8185
w.WriteB(byte(aer.VMState))
8286
w.WriteU64LE(uint64(aer.GasConsumed))
8387
// Stack items are expected to be marshaled one by one.
@@ -95,7 +99,7 @@ func (aer *AppExecResult) EncodeBinaryWithContext(w *io.BinWriter, sc *stackitem
9599
aer.Events[i].EncodeBinaryWithContext(w, sc)
96100
}
97101
w.WriteVarBytes([]byte(aer.FaultException))
98-
if invocLen := len(aer.Invocations); invocLen > 0 {
102+
if invocLen > 0 {
99103
w.WriteVarUint(uint64(invocLen))
100104
for i := range aer.Invocations {
101105
aer.Invocations[i].EncodeBinaryWithContext(w, sc)
@@ -126,7 +130,7 @@ func (aer *AppExecResult) DecodeBinary(r *io.BinReader) {
126130
aer.Stack = arr
127131
r.ReadArray(&aer.Events)
128132
aer.FaultException = r.ReadString()
129-
if r.Len() > 0 {
133+
if aer.VMState&0x80 != 0 {
130134
r.ReadArray(&aer.Invocations)
131135
}
132136
}

0 commit comments

Comments
 (0)