Pulled out all config structs (except p2p.PeerConfig) into config package

This commit is contained in:
Ethan Frey
2017-05-04 20:07:08 +02:00
committed by Ethan Buchman
parent f217f2b2c5
commit 604bf03f3a
12 changed files with 310 additions and 467 deletions

View File

@@ -12,6 +12,7 @@ import (
"github.com/tendermint/tmlibs/clist"
cmn "github.com/tendermint/tmlibs/common"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/proxy"
"github.com/tendermint/tendermint/types"
)
@@ -47,7 +48,7 @@ TODO: Better handle abci client errors. (make it automatically handle connection
const cacheSize = 100000
type Mempool struct {
config *Config
config *cfg.MempoolConfig
proxyMtx sync.Mutex
proxyAppConn proxy.AppConnMempool
@@ -66,7 +67,7 @@ type Mempool struct {
wal *auto.AutoFile
}
func NewMempool(config *Config, proxyAppConn proxy.AppConnMempool) *Mempool {
func NewMempool(config *cfg.MempoolConfig, proxyAppConn proxy.AppConnMempool) *Mempool {
mempool := &Mempool{
config: config,
proxyAppConn: proxyAppConn,

View File

@@ -10,6 +10,7 @@ import (
"github.com/tendermint/go-wire"
"github.com/tendermint/tmlibs/clist"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/types"
)
@@ -21,31 +22,15 @@ const (
peerCatchupSleepIntervalMS = 100 // If peer is behind, sleep this amount
)
type Config struct {
Recheck bool `mapstructure:"recheck"` // true
RecheckEmpty bool `mapstructure:"recheck_empty"` // true
Broadcast bool `mapstructure:"broadcast"` // true
WalDir string `mapstructure:"wal_dir"` //
}
func NewDefaultConfig(rootDir string) *Config {
return &Config{
Recheck: true,
RecheckEmpty: true,
Broadcast: true,
WalDir: rootDir + "/data/mempool.wal",
}
}
// MempoolReactor handles mempool tx broadcasting amongst peers.
type MempoolReactor struct {
p2p.BaseReactor
config *Config
config *cfg.MempoolConfig
Mempool *Mempool
evsw types.EventSwitch
}
func NewMempoolReactor(config *Config, mempool *Mempool) *MempoolReactor {
func NewMempoolReactor(config *cfg.MempoolConfig, mempool *Mempool) *MempoolReactor {
memR := &MempoolReactor{
config: config,
Mempool: mempool,