forked from TrueCloudLab/frostfs-node
[#873] node: Make deposits depend on epoch and balances
SN tries to keep 1:3 proportion of GAS and notary balances respectively. If that proportion has been messed(means that notary balance is lower than required) it sends half of its GAS balance to the notary service. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
d2096b392c
commit
5e816dc01a
2 changed files with 31 additions and 6 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
netmapSDK "github.com/nspcc-dev/neofs-api-go/pkg/netmap"
|
||||
netmapV2 "github.com/nspcc-dev/neofs-api-go/v2/netmap"
|
||||
netmapGRPC "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc"
|
||||
morphconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/morph"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/core/netmap"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
|
||||
netmapEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap"
|
||||
|
@ -145,6 +146,19 @@ func initNetmapService(c *cfg) {
|
|||
|
||||
c.handleLocalNodeInfo(ni)
|
||||
})
|
||||
|
||||
if c.cfgMorph.notaryEnabled {
|
||||
c.cfgMorph.notaryDepositDuration = morphconfig.Notary(c.appCfg).Duration()
|
||||
|
||||
addNewEpochAsyncNotificationHandler(c, func(ev event.Event) {
|
||||
_, err := makeNotaryDeposit(c)
|
||||
if err != nil {
|
||||
c.log.Error("could not make notary deposit",
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func bootstrapNode(c *cfg) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue