[#127] Remove magic number from config

With neo-project/neo-modules#358 nodes support RPC to
return used magic number. Therefore client doesn't need
that configuration value any more.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-11-02 11:16:22 +03:00 committed by Alex Vanin
parent 174efc9df3
commit 83119c00ec
3 changed files with 0 additions and 21 deletions

View file

@ -3,7 +3,6 @@ package main
import (
"strings"
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
"github.com/nspcc-dev/neofs-node/misc"
"github.com/spf13/viper"
)
@ -51,12 +50,10 @@ func defaultConfiguration(cfg *viper.Viper) {
cfg.SetDefault("morph.endpoint.client", "")
cfg.SetDefault("morph.endpoint.notification", "")
cfg.SetDefault("morph.dial_timeout", "10s")
cfg.SetDefault("morph.magic_number", uint32(netmode.PrivNet))
cfg.SetDefault("mainnet.endpoint.client", "")
cfg.SetDefault("mainnet.endpoint.notification", "")
cfg.SetDefault("mainnet.dial_timeout", "10s")
cfg.SetDefault("mainnet.magic_number", uint32(netmode.PrivNet))
cfg.SetDefault("key", "") // inner ring node key

View file

@ -4,7 +4,6 @@ import (
"context"
"crypto/ecdsa"
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
"github.com/nspcc-dev/neo-go/pkg/util"
crypto "github.com/nspcc-dev/neofs-crypto"
"github.com/nspcc-dev/neofs-node/pkg/innerring/invoke"
@ -302,7 +301,6 @@ func createClient(ctx context.Context, p *chainParams) (*client.Client, error) {
client.WithContext(ctx),
client.WithLogger(p.log),
client.WithDialTimeout(p.cfg.GetDuration(p.name+".dial_timeouts")),
client.WithMagic(netmode.Magic(p.cfg.GetUint32(p.name+".magic_number"))),
client.WithGasContract(p.gas),
)
}

View file

@ -5,7 +5,6 @@ import (
"crypto/ecdsa"
"time"
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neo-go/pkg/rpc/client"
"github.com/nspcc-dev/neo-go/pkg/util"
@ -24,8 +23,6 @@ type cfg struct {
dialTimeout time.Duration // client dial timeout
magic netmode.Magic // type of Neo blockchain network
logger *logger.Logger // logging component
gas util.Uint160 // native gas script-hash
@ -33,13 +30,10 @@ type cfg struct {
const defaultDialTimeout = 5 * time.Second
const defaultMagic = netmode.PrivNet
func defaultConfig() *cfg {
return &cfg{
ctx: context.Background(),
dialTimeout: defaultDialTimeout,
magic: defaultMagic,
logger: zap.L(),
gas: util.Uint160{},
}
@ -131,16 +125,6 @@ func WithDialTimeout(dur time.Duration) Option {
}
}
// WithMagic returns a client constructor option
// that specifies neo blockchain network type.
//
// If option not provided, netmode.PrivNet is used.
func WithMagic(mag netmode.Magic) Option {
return func(c *cfg) {
c.magic = mag
}
}
// WithLogger returns a client constructor option
// that specifies the component for writing log messages.
//