Skip to content

Commit

Permalink
get uts to compile
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalicevic committed Jan 11, 2025
1 parent 15e1cfc commit 3caca93
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 5 additions & 2 deletions internal/consensus/byzantine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,19 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
}

var extCommit *types.ExtendedCommit
lc, ok := lazyProposer.LastCommit.(*types.VoteSet)
switch {
case lazyProposer.Height == lazyProposer.state.InitialHeight:
// We're creating a proposal for the first block.
// The commit is empty, but not nil.
extCommit = &types.ExtendedCommit{}
case lazyProposer.LastCommit.HasTwoThirdsMajority():
case ok && lc.HasTwoThirdsMajority():
// Make the commit from LastCommit
// Vote extensions are enabled by default for test units
veHeightParam := lazyProposer.state.ConsensusParams.Feature
extCommit = lazyProposer.LastCommit.MakeExtendedCommit(veHeightParam)
if lastC, ok := lazyProposer.LastCommit.(*types.VoteSet); ok {
extCommit = lastC.MakeExtendedCommit(veHeightParam)
}
default: // This shouldn't happen.
lazyProposer.Logger.Error("enterPropose: Cannot propose anything: No commit for the previous block")
return
Expand Down
13 changes: 8 additions & 5 deletions internal/consensus/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,14 @@ func validateLastPrecommit(t *testing.T, cs *State, privVal *validatorStub, bloc
require.NoError(t, err)
address := pv.Address()
var vote *types.Vote
if vote = votes.GetByAddress(address); vote == nil {
panic("Failed to find precommit from validator")
}
if !bytes.Equal(vote.BlockID.Hash, blockHash) {
panic(fmt.Sprintf("Expected precommit to be for %X, got %X", blockHash, vote.BlockID.Hash))
if vs, ok := votes.(*types.VoteSet); ok {

if vote = vs.GetByAddress(address); vote == nil {
panic("Failed to find precommit from validator")
}
if !bytes.Equal(vote.BlockID.Hash, blockHash) {
panic(fmt.Sprintf("Expected precommit to be for %X, got %X", blockHash, vote.BlockID.Hash))
}
}
}

Expand Down

0 comments on commit 3caca93

Please sign in to comment.