native: add calling script hash to NEP5 transfer witness check
Fix transfers from contract's address.
This commit is contained in:
parent
d4c3a17883
commit
59be6bcd24
1 changed files with 8 additions and 6 deletions
|
@ -175,13 +175,15 @@ func (c *nep5TokenNative) transfer(ic *interop.Context, from, to util.Uint160, a
|
||||||
return errors.New("negative amount")
|
return errors.New("negative amount")
|
||||||
}
|
}
|
||||||
|
|
||||||
ok, err := runtime.CheckHashedWitness(ic, from)
|
caller := ic.ScriptGetter.GetCallingScriptHash()
|
||||||
if err != nil {
|
if caller.Equals(util.Uint160{}) || !from.Equals(caller) {
|
||||||
return err
|
ok, err := runtime.CheckHashedWitness(ic, from)
|
||||||
} else if !ok {
|
if err != nil {
|
||||||
return errors.New("invalid signature")
|
return err
|
||||||
|
} else if !ok {
|
||||||
|
return errors.New("invalid signature")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isEmpty := from.Equals(to) || amount.Sign() == 0
|
isEmpty := from.Equals(to) || amount.Sign() == 0
|
||||||
inc := amount
|
inc := amount
|
||||||
if isEmpty {
|
if isEmpty {
|
||||||
|
|
Loading…
Reference in a new issue