*: move wallet config from wallet to config package

In order to avoid dependency cycle at the next commits:

	imports github.com/nspcc-dev/neo-go/pkg/config
	imports github.com/nspcc-dev/neo-go/pkg/wallet
	imports github.com/nspcc-dev/neo-go/pkg/vm
	imports github.com/nspcc-dev/neo-go/pkg/smartcontract/nef
	imports github.com/nspcc-dev/neo-go/pkg/config
This commit is contained in:
Anna Shaleva 2020-06-26 17:23:10 +03:00
parent 927127e5fb
commit 6b8957243a
5 changed files with 9 additions and 11 deletions

View file

@ -6,7 +6,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/core/storage" "github.com/nspcc-dev/neo-go/pkg/core/storage"
"github.com/nspcc-dev/neo-go/pkg/network/metrics" "github.com/nspcc-dev/neo-go/pkg/network/metrics"
"github.com/nspcc-dev/neo-go/pkg/rpc" "github.com/nspcc-dev/neo-go/pkg/rpc"
"github.com/nspcc-dev/neo-go/pkg/wallet"
) )
// ApplicationConfiguration config specific to the node. // ApplicationConfiguration config specific to the node.
@ -26,5 +25,5 @@ type ApplicationConfiguration struct {
ProtoTickInterval time.Duration `yaml:"ProtoTickInterval"` ProtoTickInterval time.Duration `yaml:"ProtoTickInterval"`
Relay bool `yaml:"Relay"` Relay bool `yaml:"Relay"`
RPC rpc.Config `yaml:"RPC"` RPC rpc.Config `yaml:"RPC"`
UnlockWallet wallet.Config `yaml:"UnlockWallet"` UnlockWallet Wallet `yaml:"UnlockWallet"`
} }

View file

@ -1,7 +1,7 @@
package wallet package config
// Config is a wallet info. // Wallet is a wallet info.
type Config struct { type Wallet struct {
Path string `yaml:"Path"` Path string `yaml:"Path"`
Password string `yaml:"Password"` Password string `yaml:"Password"`
} }

View file

@ -9,6 +9,7 @@ import (
"github.com/nspcc-dev/dbft/block" "github.com/nspcc-dev/dbft/block"
"github.com/nspcc-dev/dbft/crypto" "github.com/nspcc-dev/dbft/crypto"
"github.com/nspcc-dev/dbft/payload" "github.com/nspcc-dev/dbft/payload"
"github.com/nspcc-dev/neo-go/pkg/config"
"github.com/nspcc-dev/neo-go/pkg/config/netmode" "github.com/nspcc-dev/neo-go/pkg/config/netmode"
coreb "github.com/nspcc-dev/neo-go/pkg/core/block" coreb "github.com/nspcc-dev/neo-go/pkg/core/block"
"github.com/nspcc-dev/neo-go/pkg/core/blockchainer" "github.com/nspcc-dev/neo-go/pkg/core/blockchainer"
@ -80,7 +81,7 @@ type Config struct {
// TimePerBlock minimal time that should pass before next block is accepted. // TimePerBlock minimal time that should pass before next block is accepted.
TimePerBlock time.Duration TimePerBlock time.Duration
// Wallet is a local-node wallet configuration. // Wallet is a local-node wallet configuration.
Wallet *wallet.Config Wallet *config.Wallet
} }
// NewService returns new consensus.Service instance. // NewService returns new consensus.Service instance.

View file

@ -17,7 +17,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/vm/emit" "github.com/nspcc-dev/neo-go/pkg/vm/emit"
"github.com/nspcc-dev/neo-go/pkg/vm/opcode" "github.com/nspcc-dev/neo-go/pkg/vm/opcode"
"github.com/nspcc-dev/neo-go/pkg/wallet"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest" "go.uber.org/zap/zaptest"
) )
@ -202,7 +201,7 @@ func newTestService(t *testing.T) *service {
Broadcast: func(*Payload) {}, Broadcast: func(*Payload) {},
Chain: newTestChain(t), Chain: newTestChain(t),
RequestTx: func(...util.Uint256) {}, RequestTx: func(...util.Uint256) {},
Wallet: &wallet.Config{ Wallet: &config.Wallet{
Path: "./testdata/wallet1.json", Path: "./testdata/wallet1.json",
Password: "one", Password: "one",
}, },

View file

@ -5,7 +5,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/config" "github.com/nspcc-dev/neo-go/pkg/config"
"github.com/nspcc-dev/neo-go/pkg/config/netmode" "github.com/nspcc-dev/neo-go/pkg/config/netmode"
"github.com/nspcc-dev/neo-go/pkg/wallet"
"go.uber.org/zap/zapcore" "go.uber.org/zap/zapcore"
) )
@ -63,7 +62,7 @@ type (
LogLevel zapcore.Level LogLevel zapcore.Level
// Wallet is a wallet configuration. // Wallet is a wallet configuration.
Wallet *wallet.Config Wallet *config.Wallet
// TimePerBlock is an interval which should pass between two successive blocks. // TimePerBlock is an interval which should pass between two successive blocks.
TimePerBlock time.Duration TimePerBlock time.Duration
@ -76,7 +75,7 @@ func NewServerConfig(cfg config.Config) ServerConfig {
appConfig := cfg.ApplicationConfiguration appConfig := cfg.ApplicationConfiguration
protoConfig := cfg.ProtocolConfiguration protoConfig := cfg.ProtocolConfiguration
var wc *wallet.Config var wc *config.Wallet
if appConfig.UnlockWallet.Path != "" { if appConfig.UnlockWallet.Path != "" {
wc = &appConfig.UnlockWallet wc = &appConfig.UnlockWallet
} }