forked from TrueCloudLab/neoneo-go
Merge pull request #1331 from nspcc-dev/persist-fix
core: fix getOnPersistWrapper for native contracts
This commit is contained in:
commit
e726df8d15
1 changed files with 6 additions and 1 deletions
|
@ -2,6 +2,7 @@ package native
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/core/dao"
|
"github.com/nspcc-dev/neo-go/pkg/core/dao"
|
||||||
|
@ -303,6 +304,10 @@ func toUint160(s stackitem.Item) util.Uint160 {
|
||||||
|
|
||||||
func getOnPersistWrapper(f func(ic *interop.Context) error) interop.Method {
|
func getOnPersistWrapper(f func(ic *interop.Context) error) interop.Method {
|
||||||
return func(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
|
return func(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
|
||||||
return stackitem.NewBool(f(ic) == nil)
|
err := f(ic)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Errorf("OnPersist for native contract: %w", err))
|
||||||
|
}
|
||||||
|
return stackitem.Null{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue