forked from TrueCloudLab/neoneo-go
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:
parent
d2f452c240
commit
1a5fb01e61
2 changed files with 43 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue