From c4646bf87fb0f44824287d49d2c167081f2614d1 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Fri, 13 Oct 2017 12:43:14 +0400 Subject: [PATCH] make state#Params not a pointer also remove the comment --- consensus/replay_test.go | 2 +- state/state.go | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/consensus/replay_test.go b/consensus/replay_test.go index 6a6b1bcf3..98295ec44 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -562,7 +562,7 @@ func stateAndStore(config *cfg.Config, pubKey crypto.PubKey) (*sm.State, *mockBl state, _ := sm.MakeGenesisStateFromFile(stateDB, config.GenesisFile()) state.SetLogger(log.TestingLogger().With("module", "state")) - store := NewMockBlockStore(config, *state.Params) + store := NewMockBlockStore(config, state.Params) return state, store } diff --git a/state/state.go b/state/state.go index 995773cb1..d3646cf18 100644 --- a/state/state.go +++ b/state/state.go @@ -38,11 +38,9 @@ type State struct { mtx sync.Mutex db dbm.DB - // See https://github.com/tendermint/tendermint/issues/671. ChainID string - // consensus parameters used for validating blocks - // must not be nil - Params *types.ConsensusParams + // Consensus parameters used for validating blocks + Params types.ConsensusParams // These fields are updated by SetBlockAndValidators. // LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) @@ -113,7 +111,6 @@ func (s *State) SetLogger(l log.Logger) { // Copy makes a copy of the State for mutating. func (s *State) Copy() *State { - paramsCopy := *s.Params return &State{ db: s.db, LastBlockHeight: s.LastBlockHeight, @@ -126,7 +123,7 @@ func (s *State) Copy() *State { LastHeightValidatorsChanged: s.LastHeightValidatorsChanged, logger: s.logger, ChainID: s.ChainID, - Params: ¶msCopy, + Params: s.Params, } } @@ -360,7 +357,7 @@ func MakeGenesisState(db dbm.DB, genDoc *types.GenesisDoc) (*State, error) { db: db, ChainID: genDoc.ChainID, - Params: genDoc.ConsensusParams, + Params: *genDoc.ConsensusParams, LastBlockHeight: 0, LastBlockID: types.BlockID{},