[#2075] morph: Do not do notary deposit with zero balance

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
remotes/fyrchik/metrics-per-container
Pavel Karpy 2022-11-22 18:19:27 +03:00 committed by fyrchik
parent c01d4ecb50
commit b8c30b88f6
2 changed files with 5 additions and 0 deletions

View File

@ -44,6 +44,7 @@ Changelog for NeoFS Node
- Pack arguments of `setPrice` invocation during contract update (#2078)
- `neofs-cli object hash` panic (#2079)
- Closing `neo-go` WS clients on shutdown and switch processes (#2080)
- Making notary deposits with a zero GAS balance (#2080)
### Removed
- `-g` option from `neofs-cli control ...` and `neofs-cli container create` commands (#2089)

View File

@ -825,6 +825,10 @@ func CalculateNotaryDepositAmount(c *Client, gasMul, gasDiv int64) (fixedn.Fixed
return 0, fmt.Errorf("could not get GAS balance: %w", err)
}
if gasBalance == 0 {
return 0, errors.New("zero gas balance, nothing to deposit")
}
var depositAmount int64
if gasBalance*gasMul > notaryBalance {