mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 03:41:34 +00:00
core: DeepCopy notifiction event args inside System.Runtime.Notify
This commit is contained in:
parent
7296f0c913
commit
42a051e55a
5 changed files with 5 additions and 5 deletions
|
@ -319,7 +319,7 @@ func TestNEP11_ND_OwnerOf_BalanceOf_Transfer(t *testing.T) {
|
|||
ScriptHash: verifyH,
|
||||
Name: "OnNEP11Payment",
|
||||
Item: stackitem.NewArray([]stackitem.Item{
|
||||
stackitem.NewBuffer(nftOwnerHash.BytesBE()),
|
||||
stackitem.NewByteArray(nftOwnerHash.BytesBE()),
|
||||
stackitem.NewBigInteger(big.NewInt(1)),
|
||||
stackitem.NewByteArray(tokenID1),
|
||||
stackitem.NewByteArray([]byte("some_data")),
|
||||
|
|
|
@ -68,7 +68,7 @@ func Notify(ic *interop.Context) error {
|
|||
if len(bytes) > MaxNotificationSize {
|
||||
return fmt.Errorf("notification size shouldn't exceed %d", MaxNotificationSize)
|
||||
}
|
||||
ic.AddNotification(ic.VM.GetCurrentScriptHash(), name, stackitem.DeepCopy(stackitem.NewArray(args), false).(*stackitem.Array))
|
||||
ic.AddNotification(ic.VM.GetCurrentScriptHash(), name, stackitem.DeepCopy(stackitem.NewArray(args), true).(*stackitem.Array))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ func GetNotifications(ic *interop.Context) error {
|
|||
ev := stackitem.NewArray([]stackitem.Item{
|
||||
stackitem.NewByteArray(notifications[i].ScriptHash.BytesBE()),
|
||||
stackitem.Make(notifications[i].Name),
|
||||
stackitem.DeepCopy(notifications[i].Item, false).(*stackitem.Array),
|
||||
notifications[i].Item,
|
||||
})
|
||||
arr.Append(ev)
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ func opParamSlotsPushVM(op opcode.Opcode, param []byte, sslot int, slotloc int,
|
|||
for i := range items {
|
||||
item, ok := items[i].(stackitem.Item)
|
||||
if ok {
|
||||
item = stackitem.DeepCopy(item, false)
|
||||
item = stackitem.DeepCopy(item, true)
|
||||
} else {
|
||||
item = stackitem.Make(items[i])
|
||||
}
|
||||
|
|
|
@ -1217,7 +1217,7 @@ func deepCopy(item Item, seen map[Item]Item, asImmutable bool) Item {
|
|||
return NewByteArray(slice.Copy(*it))
|
||||
case *Buffer:
|
||||
if asImmutable {
|
||||
return NewByteArray(slice.Copy(*it)) // TODO: ported as is from C#, but is this correct?
|
||||
return NewByteArray(slice.Copy(*it))
|
||||
}
|
||||
return NewBuffer(slice.Copy(*it))
|
||||
case Bool:
|
||||
|
|
Loading…
Reference in a new issue