mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-08 14:21:14 +00:00
remove or comment out unused code
This commit is contained in:
@@ -398,12 +398,3 @@ func BenchmarkSecretConnection(b *testing.B) {
|
||||
}
|
||||
//barSecConn.Close() race condition
|
||||
}
|
||||
|
||||
func fingerprint(bz []byte) []byte {
|
||||
const fbsize = 40
|
||||
if len(bz) < fbsize {
|
||||
return bz
|
||||
} else {
|
||||
return bz[:fbsize]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -480,14 +480,12 @@ func (sw *Switch) acceptRoutine() {
|
||||
metrics: sw.metrics,
|
||||
})
|
||||
if err != nil {
|
||||
switch err.(type) {
|
||||
switch err := err.(type) {
|
||||
case ErrRejected:
|
||||
rErr := err.(ErrRejected)
|
||||
|
||||
if rErr.IsSelf() {
|
||||
if err.IsSelf() {
|
||||
// Remove the given address from the address book and add to our addresses
|
||||
// to avoid dialing in the future.
|
||||
addr := rErr.Addr()
|
||||
addr := err.Addr()
|
||||
sw.addrBook.RemoveAddress(&addr)
|
||||
sw.addrBook.AddOurAddress(&addr)
|
||||
}
|
||||
|
||||
@@ -65,44 +65,44 @@ func TestTrustMetricCopyNilPointer(t *testing.T) {
|
||||
}
|
||||
|
||||
// XXX: This test fails non-deterministically
|
||||
func _TestTrustMetricStopPause(t *testing.T) {
|
||||
// The TestTicker will provide manual control over
|
||||
// the passing of time within the metric
|
||||
tt := NewTestTicker()
|
||||
tm := NewMetric()
|
||||
tm.SetTicker(tt)
|
||||
tm.Start()
|
||||
// Allow some time intervals to pass and pause
|
||||
tt.NextTick()
|
||||
tt.NextTick()
|
||||
tm.Pause()
|
||||
// func _TestTrustMetricStopPause(t *testing.T) {
|
||||
// // The TestTicker will provide manual control over
|
||||
// // the passing of time within the metric
|
||||
// tt := NewTestTicker()
|
||||
// tm := NewMetric()
|
||||
// tm.SetTicker(tt)
|
||||
// tm.Start()
|
||||
// // Allow some time intervals to pass and pause
|
||||
// tt.NextTick()
|
||||
// tt.NextTick()
|
||||
// tm.Pause()
|
||||
|
||||
// could be 1 or 2 because Pause and NextTick race
|
||||
first := tm.Copy().numIntervals
|
||||
// // could be 1 or 2 because Pause and NextTick race
|
||||
// first := tm.Copy().numIntervals
|
||||
|
||||
// Allow more time to pass and check the intervals are unchanged
|
||||
tt.NextTick()
|
||||
tt.NextTick()
|
||||
assert.Equal(t, first, tm.Copy().numIntervals)
|
||||
// // Allow more time to pass and check the intervals are unchanged
|
||||
// tt.NextTick()
|
||||
// tt.NextTick()
|
||||
// assert.Equal(t, first, tm.Copy().numIntervals)
|
||||
|
||||
// Get the trust metric activated again
|
||||
tm.GoodEvents(5)
|
||||
// Allow some time intervals to pass and stop
|
||||
tt.NextTick()
|
||||
tt.NextTick()
|
||||
tm.Stop()
|
||||
tm.Wait()
|
||||
// // Get the trust metric activated again
|
||||
// tm.GoodEvents(5)
|
||||
// // Allow some time intervals to pass and stop
|
||||
// tt.NextTick()
|
||||
// tt.NextTick()
|
||||
// tm.Stop()
|
||||
// tm.Wait()
|
||||
|
||||
second := tm.Copy().numIntervals
|
||||
// Allow more intervals to pass while the metric is stopped
|
||||
// and check that the number of intervals match
|
||||
tm.NextTimeInterval()
|
||||
tm.NextTimeInterval()
|
||||
// XXX: fails non-deterministically:
|
||||
// expected 5, got 6
|
||||
assert.Equal(t, second+2, tm.Copy().numIntervals)
|
||||
// second := tm.Copy().numIntervals
|
||||
// // Allow more intervals to pass while the metric is stopped
|
||||
// // and check that the number of intervals match
|
||||
// tm.NextTimeInterval()
|
||||
// tm.NextTimeInterval()
|
||||
// // XXX: fails non-deterministically:
|
||||
// // expected 5, got 6
|
||||
// assert.Equal(t, second+2, tm.Copy().numIntervals)
|
||||
|
||||
if first > second {
|
||||
t.Fatalf("numIntervals should always increase or stay the same over time")
|
||||
}
|
||||
}
|
||||
// if first > second {
|
||||
// t.Fatalf("numIntervals should always increase or stay the same over time")
|
||||
// }
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user