Browse Source

fix consensus tests

pull/1347/head
Ethan Buchman 6 years ago
parent
commit
799beebd36
5 changed files with 8 additions and 9 deletions
  1. +1
    -1
      config/toml.go
  2. +4
    -3
      consensus/state.go
  3. +2
    -3
      consensus/state_test.go
  4. +0
    -1
      consensus/wal.go
  5. +1
    -1
      consensus/wal_test.go

+ 1
- 1
config/toml.go View File

@ -287,7 +287,7 @@ var testGenesis = `{
}`
var testPrivValidator = `{
"address": "D028C9981F7A87F3093672BF0D5B0E2A1B3ED456",
"address": "515252BC8788931ADFF4796A389C9B1F7925A1B7",
"pub_key": {
"type": "AC26791624DE60",
"value": "AT/+aaL1eB0477Mud9JMm8Sh8BIvOYlPGC9KkIUmFaE="


+ 4
- 3
consensus/state.go View File

@ -4,14 +4,15 @@ import (
"bytes"
"errors"
"fmt"
fail "github.com/ebuchman/fail-test"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
"reflect"
"runtime/debug"
"sync"
"time"
fail "github.com/ebuchman/fail-test"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
cfg "github.com/tendermint/tendermint/config"
cstypes "github.com/tendermint/tendermint/consensus/types"
"github.com/tendermint/tendermint/p2p"


+ 2
- 3
consensus/state_test.go View File

@ -409,8 +409,7 @@ func TestStateLockNoPOL(t *testing.T) {
validatePrevote(t, cs1, 1, vss[0], rs.LockedBlock.Hash())
// add a conflicting prevote from the other validator
fmt.Println(">>", rs.ProposalBlock)
signAddVotes(cs1, types.VoteTypePrevote, hash, rs.ProposalBlock.MakePartSet(partSize).Header(), vs2)
signAddVotes(cs1, types.VoteTypePrevote, hash, rs.LockedBlock.MakePartSet(partSize).Header(), vs2)
<-voteCh
// now we're going to enter prevote again, but with invalid args
@ -425,7 +424,7 @@ func TestStateLockNoPOL(t *testing.T) {
// add conflicting precommit from vs2
// NOTE: in practice we should never get to a point where there are precommits for different blocks at the same round
signAddVotes(cs1, types.VoteTypePrecommit, hash, rs.ProposalBlock.MakePartSet(partSize).Header(), vs2)
signAddVotes(cs1, types.VoteTypePrecommit, hash, rs.LockedBlock.MakePartSet(partSize).Header(), vs2)
<-voteCh
// (note we're entering precommit for a second time this round, but with invalid args


+ 0
- 1
consensus/wal.go View File

@ -113,7 +113,6 @@ func (wal *baseWAL) OnStop() {
// called in newStep and for each pass in receiveRoutine
func (wal *baseWAL) Save(msg WALMessage) {
fmt.Println("!!", 1)
if wal == nil {
return
}


+ 1
- 1
consensus/wal_test.go View File

@ -35,7 +35,7 @@ func TestWALEncoderDecoder(t *testing.T) {
decoded, err := dec.Decode()
require.NoError(t, err)
assert.Equal(t, msg.Time.Truncate(time.Millisecond), decoded.Time)
assert.True(t, msg.Time.Equal(decoded.Time))
assert.Equal(t, msg.Msg, decoded.Msg)
}
}


Loading…
Cancel
Save