[#486] innerring: Add option to disable only main chain notary support

For N3 Testnet RC2 release inner ring app supports three modes:
- notary enabled in all chains (default),
- notary disabled in all chains,
- notary enabled only in side chain.

All notary related functions are moved to notary.go

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-05-04 11:50:13 +03:00 committed by Alex Vanin
parent 94a1947482
commit dddbf0368c
4 changed files with 149 additions and 83 deletions

View file

@ -1,6 +1,8 @@
package innerring
import (
"context"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/alphabet"
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/netmap"
@ -47,10 +49,13 @@ type (
emitDuration uint32 // in blocks
}
depositor func() (util.Uint256, error)
awaiter func(context.Context, util.Uint256) error
notaryDepositArgs struct {
l *zap.Logger
depositor func() (util.Uint256, util.Uint256, error)
depositor depositor
notaryDuration uint32 // in blocks
}
@ -154,7 +159,7 @@ func newNotaryDepositTimer(args *notaryDepositArgs) *timer.BlockTimer {
return timer.NewBlockTimer(
timer.StaticBlockMeter(args.notaryDuration),
func() {
_, _, err := args.depositor()
_, err := args.depositor()
if err != nil {
args.l.Warn("can't deposit notary contract",
zap.String("error", err.Error()))