[#496] pkg/innerring: provide wrappers to processors

The only thing we need hashes for is to process notifications.
Balance contract if left for now, as it has some initialization.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2021-05-31 14:50:11 +03:00 committed by Alex Vanin
parent 9b87e6267d
commit 8a2b7f4501
24 changed files with 215 additions and 228 deletions

View file

@ -3,13 +3,10 @@ package netmap
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/netmap/snapshot"
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement"
"go.uber.org/zap"
)
const setNewEpochMethod = "newEpoch"
// Process new epoch notification by setting global epoch value and resetting
// local epoch timer.
func (np *Processor) processNewEpoch(epoch uint64) {
@ -20,7 +17,7 @@ func (np *Processor) processNewEpoch(epoch uint64) {
}
// get new netmap snapshot
networkMap, err := snapshot.Fetch(np.morphClient, np.netmapContract)
networkMap, err := np.netmapClient.Snapshot()
if err != nil {
np.log.Warn("can't get netmap snapshot to perform cleanup",
zap.String("error", err.Error()))
@ -55,7 +52,7 @@ func (np *Processor) processNewEpochTick() {
nextEpoch := np.epochState.EpochCounter() + 1
np.log.Debug("next epoch", zap.Uint64("value", nextEpoch))
err := np.morphClient.NotaryInvoke(np.netmapContract, np.feeProvider.SideChainFee(), setNewEpochMethod, int64(nextEpoch))
err := np.netmapClient.NewEpoch(nextEpoch)
if err != nil {
np.log.Error("can't invoke netmap.NewEpoch", zap.Error(err))
}