mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-23 03:38:35 +00:00
native: fix native contract onPersist
script
C# implementation uses NEWARRAY for creating arguments. Don't change our implementation in `emit`, because PACK is cheaper and this script must not depend on the internal details of `emit` package anyway.
This commit is contained in:
parent
3787a8895e
commit
05dad10e82
1 changed files with 5 additions and 1 deletions
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/emit"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
@ -65,7 +66,10 @@ func (cs *Contracts) GetPersistScript() []byte {
|
|||
w := io.NewBufBinWriter()
|
||||
for i := range cs.Contracts {
|
||||
md := cs.Contracts[i].Metadata()
|
||||
emit.AppCallWithOperationAndArgs(w.BinWriter, md.Hash, "onPersist")
|
||||
emit.Int(w.BinWriter, 0)
|
||||
emit.Opcode(w.BinWriter, opcode.NEWARRAY)
|
||||
emit.String(w.BinWriter, "onPersist")
|
||||
emit.AppCall(w.BinWriter, md.Hash)
|
||||
}
|
||||
cs.persistScript = w.Bytes()
|
||||
return cs.persistScript
|
||||
|
|
Loading…
Reference in a new issue