From f74d19b18a40e96ed8cc0851a40d4ceac9a1f0f4 Mon Sep 17 00:00:00 2001 From: sanaz Date: Thu, 10 Oct 2024 18:27:11 -0700 Subject: [PATCH] cleans up the code --- node/node.go | 14 +++----------- rpc/core/consensus.go | 5 ++--- state/state.go | 7 ------- state/store.go | 1 - 4 files changed, 5 insertions(+), 22 deletions(-) diff --git a/node/node.go b/node/node.go index b0ced22513..bd84aa642c 100644 --- a/node/node.go +++ b/node/node.go @@ -870,17 +870,11 @@ func NewNodeWithContext(ctx context.Context, if err != nil { return nil, fmt.Errorf("error during info call: %w", err) } - softwareVersion = resp.Version // TODO is this the same as celestia-app version + softwareVersion = resp.Version } - //resp, err := proxyApp.Query().InfoSync(proxy.RequestInfo) - //if err != nil { - // return nil, fmt.Errorf("error during info call: %w", err) - //} - // Determine whether we should do fast sync. This must happen after the handshake, since the - // app may modify the validator set, - //specifying ourselves as the only validator. + // app may modify the validator set, specifying ourselves as the only validator. fastSync := config.FastSyncMode && !onlyValidatorIsUs(state, pubKey) // the state certainly has the latest timeouts according // the app version lastBlock in the blockstore @@ -939,9 +933,7 @@ func NewNodeWithContext(ctx context.Context, privValidator, csMetrics, stateSync || fastSync, eventBus, consensusLogger, tracer, ) - logger.Info("Consensus reactor created", "timeout_propose", - consensusState.GetState().TimeoutPropose, "timeout_commit", - consensusState.GetState().TimeoutCommit) + logger.Info("Consensus reactor created", "timeout_propose", consensusState.GetState().TimeoutPropose, "timeout_commit", consensusState.GetState().TimeoutCommit) // Set up state sync reactor, and schedule a sync if requested. // FIXME The way we do phased startups (e.g. replay -> fast sync -> consensus) is very messy, // we should clean this whole thing up. See: diff --git a/rpc/core/consensus.go b/rpc/core/consensus.go index ae60b0bb80..6a82447764 100644 --- a/rpc/core/consensus.go +++ b/rpc/core/consensus.go @@ -88,9 +88,8 @@ func ConsensusState(ctx *rpctypes.Context) (*ctypes.ResultConsensusState, error) return &ctypes.ResultConsensusState{RoundState: bz}, err } -func ConsensusTimeoutsInfo(ctx *rpctypes.Context, - heightPtr int64) (*abci.TimeoutsInfo, error) { - return GetEnvironment().StateStore.LoadConsensusTimeoutsInfo(heightPtr) +func ConsensusTimeoutsInfo(ctx *rpctypes.Context, height int64) (*abci.TimeoutsInfo, error) { + return GetEnvironment().StateStore.LoadConsensusTimeoutsInfo(height) } // ConsensusParams gets the consensus parameters at the given block height. diff --git a/state/state.go b/state/state.go index 6197b9b656..a138fdfdfd 100644 --- a/state/state.go +++ b/state/state.go @@ -83,13 +83,6 @@ type State struct { TimeoutCommit time.Duration } -func (state *State) GetTimeoutPropose() time.Duration { - return state.TimeoutPropose -} -func (state *State) GetTimeoutCommit() time.Duration { - return state.TimeoutCommit -} - // Copy makes a copy of the State for mutating. func (state State) Copy() State { return State{ diff --git a/state/store.go b/state/store.go index 3f4e9ebc4a..0086e20b95 100644 --- a/state/store.go +++ b/state/store.go @@ -204,7 +204,6 @@ func (store dbStore) save(state State, key []byte) error { } // save next timeouts - // TODO write test for this if err := store.saveConsensusTimeoutsInfo(nextHeight, &abci.TimeoutsInfo{TimeoutPropose: state.TimeoutPropose, TimeoutCommit: state.TimeoutCommit}); err != nil { return err }