core: invoke contract verification script with AllowStates flag

We should call contract's `verify` with AllowStates flag.
This commit is contained in:
Anna Shaleva 2020-11-24 12:08:25 +03:00
parent eca27055b8
commit c9acc43023

View file

@ -1590,6 +1590,7 @@ func (bc *Blockchain) initVerificationVM(ic *interop.Context, hash util.Uint160,
var isNative bool
var initMD *manifest.Method
verification := witness.VerificationScript
flags := smartcontract.NoneFlag
if len(verification) != 0 {
if witness.ScriptHash() != hash {
return ErrWitnessHashMismatch
@ -1610,10 +1611,11 @@ func (bc *Blockchain) initVerificationVM(ic *interop.Context, hash util.Uint160,
offset = md.Offset
initMD = cs.Manifest.ABI.GetMethod(manifest.MethodInit)
isNative = cs.ID < 0
flags = smartcontract.AllowStates
}
v := ic.VM
v.LoadScriptWithFlags(verification, smartcontract.NoneFlag)
v.LoadScriptWithFlags(verification, flags)
v.Jump(v.Context(), offset)
if isNative {
w := io.NewBufBinWriter()