mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
cswal_light logs own votes; fix tests
This commit is contained in:
parent
16208dc172
commit
922f720cf6
@ -80,19 +80,20 @@ func TestReplayCatchup(t *testing.T) {
|
||||
// start timeout and receive routines
|
||||
cs.startRoutines(0)
|
||||
|
||||
// cs.scheduleRound0(cs.Height)
|
||||
|
||||
// open wal and run catchup messages
|
||||
openWAL(t, cs, name)
|
||||
if err := cs.catchupReplay(cs.Height); err != nil {
|
||||
t.Fatalf("Error on catchup replay %v", err)
|
||||
}
|
||||
|
||||
after := time.After(time.Second * 2)
|
||||
after := time.After(time.Second * 15)
|
||||
select {
|
||||
case <-newBlockCh:
|
||||
case <-after:
|
||||
t.Fatal("Timed out waiting for new block")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func openWAL(t *testing.T, cs *ConsensusState, file string) {
|
||||
|
@ -584,7 +584,7 @@ func TestLockPOLRelock(t *testing.T) {
|
||||
t.Fatal("Expected height to increment")
|
||||
}
|
||||
|
||||
if !bytes.Equal(b.Block.Hash(), propBlockHash) {
|
||||
if !bytes.Equal(b.Block.Header.Hash(), propBlockHash) {
|
||||
t.Fatal("Expected new block to be proposal block")
|
||||
}
|
||||
}
|
||||
|
@ -64,9 +64,12 @@ func NewWAL(file string, light bool) (*WAL, error) {
|
||||
func (wal *WAL) Save(clm ConsensusLogMessageInterface) {
|
||||
if wal != nil {
|
||||
if wal.light {
|
||||
// in light mode we only write new steps and timeouts (no votes, proposals, block parts)
|
||||
if _, ok := clm.(msgInfo); ok {
|
||||
return
|
||||
// in light mode we only write new steps, timeouts, and our own votes (no proposals, block parts)
|
||||
if mi, ok := clm.(msgInfo); ok {
|
||||
_ = mi
|
||||
if mi.PeerKey != "" {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
var n int
|
||||
|
@ -268,7 +268,7 @@ func (psr *PartSetReader) Read(p []byte) (n int, err error) {
|
||||
|
||||
psr.i += 1
|
||||
if psr.i >= len(psr.parts) {
|
||||
return 0, fmt.Errorf("Attempt to read from PartSet but no parts left")
|
||||
return 0, io.EOF
|
||||
}
|
||||
psr.reader = bytes.NewReader(psr.parts[psr.i].Bytes)
|
||||
return psr.Read(p)
|
||||
|
@ -30,7 +30,7 @@ func TestBasicPartSet(t *testing.T) {
|
||||
for i := 0; i < partSet.Total(); i++ {
|
||||
part := partSet.GetPart(i)
|
||||
//t.Logf("\n%v", part)
|
||||
added, err := partSet2.AddPart(part)
|
||||
added, err := partSet2.AddPart(part, true)
|
||||
if !added || err != nil {
|
||||
t.Errorf("Failed to add part %v, error: %v", i, err)
|
||||
}
|
||||
@ -70,7 +70,7 @@ func TestWrongProof(t *testing.T) {
|
||||
// Test adding a part with wrong trail.
|
||||
part := partSet.GetPart(0)
|
||||
part.Proof.Aunts[0][0] += byte(0x01)
|
||||
added, err := partSet2.AddPart(part)
|
||||
added, err := partSet2.AddPart(part, true)
|
||||
if added || err == nil {
|
||||
t.Errorf("Expected to fail adding a part with bad trail.")
|
||||
}
|
||||
@ -78,7 +78,7 @@ func TestWrongProof(t *testing.T) {
|
||||
// Test adding a part with wrong bytes.
|
||||
part = partSet.GetPart(1)
|
||||
part.Bytes[0] += byte(0x01)
|
||||
added, err = partSet2.AddPart(part)
|
||||
added, err = partSet2.AddPart(part, true)
|
||||
if added || err == nil {
|
||||
t.Errorf("Expected to fail adding a part with bad bytes.")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user