[#15] Check amount value in withdraw method

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-08-26 12:19:40 +03:00 committed by Alex Vanin
parent 7a275a3c4b
commit d75c11c897

View file

@ -228,10 +228,12 @@ func Withdraw(user []byte, amount int) bool {
panic("withdraw: you should be the owner of the wallet") panic("withdraw: you should be the owner of the wallet")
} }
if amount > 0 { if amount < 0 {
amount = amount * 100000000 panic("withdraw: non positive amount number")
} }
amount = amount * 100000000
tx := runtime.GetScriptContainer() tx := runtime.GetScriptContainer()
runtime.Notify("Withdraw", user, amount, tx.Hash) runtime.Notify("Withdraw", user, amount, tx.Hash)