From b8c30b88f63958fac579a202f0153a26ce3c7288 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 22 Nov 2022 18:19:27 +0300 Subject: [PATCH] [#2075] morph: Do not do notary deposit with zero balance Signed-off-by: Pavel Karpy --- CHANGELOG.md | 1 + pkg/morph/client/notary.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad5a01437..35167b65b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/pkg/morph/client/notary.go b/pkg/morph/client/notary.go index 5122b550b..0b9c72c41 100644 --- a/pkg/morph/client/notary.go +++ b/pkg/morph/client/notary.go @@ -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 {