check transfer amounts are positive values

This commit is contained in:
whyrusleeping 2019-10-12 15:57:49 +09:00
parent a56e786e36
commit 80d306de14

View File

@ -637,6 +637,10 @@ func (vm *VM) Invoke(act *types.Actor, vmctx *VMContext, method uint64, params [
}
func Transfer(from, to *types.Actor, amt types.BigInt) error {
if amt.LessThan(types.NewInt(0)) {
return xerrors.Errorf("attempted to transfer negative value")
}
if err := deductFunds(from, amt); err != nil {
return err
}