[#910] innerring: Make notary deposit on notification instead of timer

Timer is not suitable for notary deposits because it can never fire
in case of desynchronization or external epoch changes. Notary deposits
must be handled on new epoch event.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-11-01 18:55:25 +03:00 committed by Alex Vanin
parent 45f244eb77
commit a437ffc3ed
6 changed files with 35 additions and 38 deletions

View file

@ -4,12 +4,15 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/audit"
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/governance"
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement"
netmapEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap"
"go.uber.org/zap"
)
// Process new epoch notification by setting global epoch value and resetting
// local epoch timer.
func (np *Processor) processNewEpoch(epoch uint64) {
func (np *Processor) processNewEpoch(event netmapEvent.NewEpoch) {
epoch := event.EpochNumber()
epochDuration, err := np.netmapClient.EpochDuration()
if err != nil {
np.log.Warn("can't get epoch duration",
@ -48,6 +51,7 @@ func (np *Processor) processNewEpoch(epoch uint64) {
np.handleNewAudit(audit.NewAuditStartEvent(epoch))
np.handleAuditSettlements(settlement.NewAuditEvent(epoch))
np.handleAlphabetSync(governance.NewSyncEvent())
np.handleNotaryDeposit(event)
}
// Process new epoch tick by invoking new epoch method in network map contract.