core: adjust System.Contract.IsStandard interop

Part of #1055.

It should check not only stored contracts, but also interop context
script container in case if it's a transaction.
This commit is contained in:
Anna Shaleva 2020-07-16 09:56:57 +03:00
parent d2f452c240
commit 1a5fb01e61
2 changed files with 43 additions and 4 deletions

View file

@ -486,8 +486,17 @@ func contractIsStandard(ic *interop.Context, v *vm.VM) error {
}
var result bool
cs, _ := ic.DAO.GetContractState(u)
if cs == nil || vm.IsStandardContract(cs.Script) {
result = true
if cs != nil {
result = vm.IsStandardContract(cs.Script)
} else {
if tx, ok := ic.Container.(*transaction.Transaction); ok {
for _, witness := range tx.Scripts {
if witness.ScriptHash() == u {
result = vm.IsStandardContract(witness.VerificationScript)
break
}
}
}
}
v.Estack().PushVal(result)
return nil