[#770] node: Add notary deposit timer

Storage Node needs to have notary deposit
for successful notary request sending.
Add notary deposit on startup(and wait for
its acceptance). Add notary deposit timer,
its config in `morph` section and env vars
for its tuning.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-08-25 13:49:59 +03:00 committed by Pavel Karpy
parent e29bcd98e2
commit 722b844aa2
4 changed files with 104 additions and 2 deletions

View file

@ -5,6 +5,7 @@ import (
wrapNetmap "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper"
"github.com/nspcc-dev/neofs-node/pkg/morph/timer"
"go.uber.org/zap"
)
type (
@ -83,3 +84,18 @@ func newEigenTrustIterTimer(c *cfg, it *EigenTrustDuration, handler timer.BlockT
c.cfgMorph.blockTimers = append(c.cfgMorph.blockTimers, c.cfgMorph.eigenTrustTimer)
}
func newDepositTimer(c *cfg) {
c.cfgMorph.blockTimers = append(c.cfgMorph.blockTimers,
timer.NewBlockTimer(
timer.StaticBlockMeter(c.cfgMorph.notaryDepositDuration),
func() {
_, err := makeNotaryDeposit(c)
if err != nil {
c.log.Warn("can't deposit notary contract",
zap.String("error", err.Error()))
}
},
),
)
}