mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-03 11:45:18 +00:00
internal/libs: delete unused functionality (#7569)
This commit is contained in:
@@ -18,7 +18,6 @@ import (
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
cstypes "github.com/tendermint/tendermint/internal/consensus/types"
|
||||
"github.com/tendermint/tendermint/internal/eventbus"
|
||||
"github.com/tendermint/tendermint/internal/libs/fail"
|
||||
sm "github.com/tendermint/tendermint/internal/state"
|
||||
tmevents "github.com/tendermint/tendermint/libs/events"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
@@ -866,14 +865,6 @@ func (cs *State) receiveRoutine(ctx context.Context, maxSteps int) {
|
||||
))
|
||||
}
|
||||
|
||||
if _, ok := mi.Msg.(*VoteMessage); ok {
|
||||
// we actually want to simulate failing during
|
||||
// the previous WriteSync, but this isn't easy to do.
|
||||
// Equivalent would be to fail here and manually remove
|
||||
// some bytes from the end of the wal.
|
||||
fail.Fail() // XXX
|
||||
}
|
||||
|
||||
// handles proposals, block parts, votes
|
||||
cs.handleMsg(ctx, mi)
|
||||
|
||||
@@ -1705,8 +1696,6 @@ func (cs *State) finalizeCommit(ctx context.Context, height int64) {
|
||||
)
|
||||
logger.Debug(fmt.Sprintf("%v", block))
|
||||
|
||||
fail.Fail() // XXX
|
||||
|
||||
// Save to blockStore.
|
||||
if cs.blockStore.Height() < block.Height {
|
||||
// NOTE: the seenCommit is local justification to commit this block,
|
||||
@@ -1719,8 +1708,6 @@ func (cs *State) finalizeCommit(ctx context.Context, height int64) {
|
||||
logger.Debug("calling finalizeCommit on already stored block", "height", block.Height)
|
||||
}
|
||||
|
||||
fail.Fail() // XXX
|
||||
|
||||
// Write EndHeightMessage{} for this height, implying that the blockstore
|
||||
// has saved the block.
|
||||
//
|
||||
@@ -1742,8 +1729,6 @@ func (cs *State) finalizeCommit(ctx context.Context, height int64) {
|
||||
))
|
||||
}
|
||||
|
||||
fail.Fail() // XXX
|
||||
|
||||
// Create a copy of the state for staging and an event cache for txs.
|
||||
stateCopy := cs.state.Copy()
|
||||
|
||||
@@ -1762,16 +1747,12 @@ func (cs *State) finalizeCommit(ctx context.Context, height int64) {
|
||||
return
|
||||
}
|
||||
|
||||
fail.Fail() // XXX
|
||||
|
||||
// must be called before we update state
|
||||
cs.RecordMetrics(height, block)
|
||||
|
||||
// NewHeightStep!
|
||||
cs.updateToState(ctx, stateCopy)
|
||||
|
||||
fail.Fail() // XXX
|
||||
|
||||
// Private validator might have changed it's key pair => refetch pubkey.
|
||||
if err := cs.updatePrivValidatorPubKey(ctx); err != nil {
|
||||
logger.Error("failed to get private validator pubkey", "err", err)
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package fail
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func envSet() int {
|
||||
callIndexToFailS := os.Getenv("FAIL_TEST_INDEX")
|
||||
|
||||
if callIndexToFailS == "" {
|
||||
return -1
|
||||
}
|
||||
|
||||
var err error
|
||||
callIndexToFail, err := strconv.Atoi(callIndexToFailS)
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
|
||||
return callIndexToFail
|
||||
}
|
||||
|
||||
// Fail when FAIL_TEST_INDEX == callIndex
|
||||
var callIndex int // indexes Fail calls
|
||||
|
||||
func Fail() {
|
||||
callIndexToFail := envSet()
|
||||
if callIndexToFail < 0 {
|
||||
return
|
||||
}
|
||||
|
||||
if callIndex == callIndexToFail {
|
||||
fmt.Printf("*** fail-test %d ***\n", callIndex)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
callIndex++
|
||||
}
|
||||
@@ -55,13 +55,6 @@ func (t *ThrottleTimer) Set() {
|
||||
}
|
||||
}
|
||||
|
||||
func (t *ThrottleTimer) Unset() {
|
||||
t.mtx.Lock()
|
||||
defer t.mtx.Unlock()
|
||||
t.isSet = false
|
||||
t.timer.Stop()
|
||||
}
|
||||
|
||||
// For ease of .Stop()'ing services before .Start()'ing them,
|
||||
// we ignore .Stop()'s on nil ThrottleTimers
|
||||
func (t *ThrottleTimer) Stop() bool {
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto/encoding"
|
||||
"github.com/tendermint/tendermint/internal/eventbus"
|
||||
"github.com/tendermint/tendermint/internal/libs/fail"
|
||||
"github.com/tendermint/tendermint/internal/mempool"
|
||||
"github.com/tendermint/tendermint/internal/proxy"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
@@ -171,15 +170,11 @@ func (blockExec *BlockExecutor) ApplyBlock(
|
||||
return state, ErrProxyAppConn(err)
|
||||
}
|
||||
|
||||
fail.Fail() // XXX
|
||||
|
||||
// Save the results before we commit.
|
||||
if err := blockExec.store.SaveABCIResponses(block.Height, abciResponses); err != nil {
|
||||
return state, err
|
||||
}
|
||||
|
||||
fail.Fail() // XXX
|
||||
|
||||
// validate the validator updates and convert to tendermint types
|
||||
abciValUpdates := abciResponses.EndBlock.ValidatorUpdates
|
||||
err = validateValidatorUpdates(abciValUpdates, state.ConsensusParams.Validator)
|
||||
@@ -210,16 +205,12 @@ func (blockExec *BlockExecutor) ApplyBlock(
|
||||
// Update evpool with the latest state.
|
||||
blockExec.evpool.Update(state, block.Evidence.Evidence)
|
||||
|
||||
fail.Fail() // XXX
|
||||
|
||||
// Update the app hash and save the state.
|
||||
state.AppHash = appHash
|
||||
if err := blockExec.store.Save(state); err != nil {
|
||||
return state, err
|
||||
}
|
||||
|
||||
fail.Fail() // XXX
|
||||
|
||||
// Prune old heights, if requested by ABCI app.
|
||||
if retainHeight > 0 {
|
||||
pruned, err := blockExec.pruneBlocks(retainHeight)
|
||||
|
||||
Reference in New Issue
Block a user