diff --git a/internal/blocksync/reactor.go b/internal/blocksync/reactor.go index d2b1eb608..144595889 100644 --- a/internal/blocksync/reactor.go +++ b/internal/blocksync/reactor.go @@ -186,7 +186,7 @@ func (r *Reactor) OnStop() { func (r *Reactor) respondToPeer(ctx context.Context, msg *bcproto.BlockRequest, peerID types.NodeID, blockSyncCh *p2p.Channel) error { block := r.store.LoadBlock(msg.Height) if block != nil { - extCommit := r.store.LoadExtendedCommit(msg.Height) + extCommit := r.store.LoadBlockExtendedCommit(msg.Height) if extCommit == nil { return fmt.Errorf("found block in store without extended commit: %v", block) } diff --git a/internal/consensus/reactor.go b/internal/consensus/reactor.go index d8cdf5e54..1a9d49057 100644 --- a/internal/consensus/reactor.go +++ b/internal/consensus/reactor.go @@ -796,7 +796,7 @@ func (r *Reactor) gossipVotesRoutine(ctx context.Context, ps *PeerState, voteCh if blockStoreBase > 0 && prs.Height != 0 && rs.Height >= prs.Height+2 && prs.Height >= blockStoreBase { // Load the block's extended commit for prs.Height, which contains precommit // signatures for prs.Height. - if ec := r.state.blockStore.LoadExtendedCommit(prs.Height); ec != nil { + if ec := r.state.blockStore.LoadBlockExtendedCommit(prs.Height); ec != nil { if ok, err := r.pickSendVote(ctx, ps, ec, voteCh); err != nil { return } else if ok { diff --git a/internal/consensus/replay_test.go b/internal/consensus/replay_test.go index a286705b9..c8f04655b 100644 --- a/internal/consensus/replay_test.go +++ b/internal/consensus/replay_test.go @@ -582,7 +582,7 @@ func setupSimulator(ctx context.Context, t *testing.T) *simulatorTestSuite { sim.ExtCommits = []*types.ExtendedCommit{} for i := 1; i <= numBlocks; i++ { sim.Chain = append(sim.Chain, css[0].blockStore.LoadBlock(int64(i))) - sim.ExtCommits = append(sim.ExtCommits, css[0].blockStore.LoadExtendedCommit(int64(i))) + sim.ExtCommits = append(sim.ExtCommits, css[0].blockStore.LoadBlockExtendedCommit(int64(i))) } return sim @@ -1213,7 +1213,7 @@ func (bs *mockBlockStore) LoadBlockCommit(height int64) *types.Commit { func (bs *mockBlockStore) LoadSeenCommit() *types.Commit { return bs.extCommits[len(bs.extCommits)-1].StripExtensions() } -func (bs *mockBlockStore) LoadExtendedCommit(height int64) *types.ExtendedCommit { +func (bs *mockBlockStore) LoadBlockExtendedCommit(height int64) *types.ExtendedCommit { return bs.extCommits[height-1] } diff --git a/internal/consensus/state.go b/internal/consensus/state.go index 0aadab05c..06efdb7a4 100644 --- a/internal/consensus/state.go +++ b/internal/consensus/state.go @@ -712,7 +712,7 @@ func (cs *State) reconstructLastCommit(state sm.State) { } func (cs *State) votesFromExtendedCommit(state sm.State, requireExtensions bool) (*types.VoteSet, error) { - ec := cs.blockStore.LoadExtendedCommit(state.LastBlockHeight) + ec := cs.blockStore.LoadBlockExtendedCommit(state.LastBlockHeight) if ec == nil { return nil, fmt.Errorf("commit for height %v not found", state.LastBlockHeight) } diff --git a/internal/state/indexer/mocks/event_sink.go b/internal/state/indexer/mocks/event_sink.go index decf551ab..69abe3907 100644 --- a/internal/state/indexer/mocks/event_sink.go +++ b/internal/state/indexer/mocks/event_sink.go @@ -6,6 +6,7 @@ import ( context "context" mock "github.com/stretchr/testify/mock" + indexer "github.com/tendermint/tendermint/internal/state/indexer" query "github.com/tendermint/tendermint/internal/pubsub/query" diff --git a/internal/state/mocks/block_store.go b/internal/state/mocks/block_store.go index ee0d46df6..4eafb1273 100644 --- a/internal/state/mocks/block_store.go +++ b/internal/state/mocks/block_store.go @@ -107,6 +107,22 @@ func (_m *BlockStore) LoadBlockCommit(height int64) *types.Commit { return r0 } +// LoadBlockExtendedCommit provides a mock function with given fields: height +func (_m *BlockStore) LoadBlockExtendedCommit(height int64) *types.ExtendedCommit { + ret := _m.Called(height) + + var r0 *types.ExtendedCommit + if rf, ok := ret.Get(0).(func(int64) *types.ExtendedCommit); ok { + r0 = rf(height) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.ExtendedCommit) + } + } + + return r0 +} + // LoadBlockMeta provides a mock function with given fields: height func (_m *BlockStore) LoadBlockMeta(height int64) *types.BlockMeta { ret := _m.Called(height) @@ -155,22 +171,6 @@ func (_m *BlockStore) LoadBlockPart(height int64, index int) *types.Part { return r0 } -// LoadExtendedCommit provides a mock function with given fields: height -func (_m *BlockStore) LoadExtendedCommit(height int64) *types.ExtendedCommit { - ret := _m.Called(height) - - var r0 *types.ExtendedCommit - if rf, ok := ret.Get(0).(func(int64) *types.ExtendedCommit); ok { - r0 = rf(height) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.ExtendedCommit) - } - } - - return r0 -} - // LoadSeenCommit provides a mock function with given fields: func (_m *BlockStore) LoadSeenCommit() *types.Commit { ret := _m.Called() diff --git a/internal/state/mocks/evidence_pool.go b/internal/state/mocks/evidence_pool.go index 49633269b..0ea3ba17b 100644 --- a/internal/state/mocks/evidence_pool.go +++ b/internal/state/mocks/evidence_pool.go @@ -6,6 +6,7 @@ import ( context "context" mock "github.com/stretchr/testify/mock" + state "github.com/tendermint/tendermint/internal/state" testing "testing" diff --git a/internal/state/mocks/store.go b/internal/state/mocks/store.go index 9b41f3c1b..1d9ef2f6f 100644 --- a/internal/state/mocks/store.go +++ b/internal/state/mocks/store.go @@ -4,6 +4,7 @@ package mocks import ( mock "github.com/stretchr/testify/mock" + state "github.com/tendermint/tendermint/internal/state" tendermintstate "github.com/tendermint/tendermint/proto/tendermint/state" diff --git a/internal/state/services.go b/internal/state/services.go index c563da3a5..35a91aa11 100644 --- a/internal/state/services.go +++ b/internal/state/services.go @@ -36,7 +36,7 @@ type BlockStore interface { LoadBlockCommit(height int64) *types.Commit LoadSeenCommit() *types.Commit - LoadExtendedCommit(height int64) *types.ExtendedCommit + LoadBlockExtendedCommit(height int64) *types.ExtendedCommit } //----------------------------------------------------------------------------- diff --git a/internal/statesync/mocks/state_provider.go b/internal/statesync/mocks/state_provider.go index 582ebcd9c..82e4bd60e 100644 --- a/internal/statesync/mocks/state_provider.go +++ b/internal/statesync/mocks/state_provider.go @@ -6,6 +6,7 @@ import ( context "context" mock "github.com/stretchr/testify/mock" + state "github.com/tendermint/tendermint/internal/state" testing "testing" diff --git a/internal/store/store.go b/internal/store/store.go index 7dacff83f..5617674a2 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -278,7 +278,7 @@ func (bs *BlockStore) LoadBlockCommit(height int64) *types.Commit { return commit } -func (bs *BlockStore) LoadExtendedCommit(height int64) *types.ExtendedCommit { +func (bs *BlockStore) LoadBlockExtendedCommit(height int64) *types.ExtendedCommit { pbec := new(tmproto.ExtendedCommit) bz, err := bs.db.Get(extCommitKey(height)) if err != nil {