mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
Addressing review comments
This commit is contained in:
parent
e5965ababe
commit
43d40ee489
@ -629,7 +629,7 @@ OUTER_LOOP:
|
|||||||
// Load the block commit for prs.Height,
|
// Load the block commit for prs.Height,
|
||||||
// which contains precommit signatures for prs.Height.
|
// which contains precommit signatures for prs.Height.
|
||||||
commit := conR.conS.blockStore.LoadBlockCommit(prs.Height)
|
commit := conR.conS.blockStore.LoadBlockCommit(prs.Height)
|
||||||
commit.AddAddresses(conR.conS.Validators.GetAddresses())
|
commit.SetAddresses(conR.conS.Validators.GetAddresses())
|
||||||
if ps.PickSendVote(commit) {
|
if ps.PickSendVote(commit) {
|
||||||
logger.Debug("Picked Catchup commit to send", "height", prs.Height)
|
logger.Debug("Picked Catchup commit to send", "height", prs.Height)
|
||||||
continue OUTER_LOOP
|
continue OUTER_LOOP
|
||||||
|
@ -452,7 +452,7 @@ func (cs *ConsensusState) reconstructLastCommit(state sm.State) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
seenCommit := cs.blockStore.LoadSeenCommit(state.LastBlockHeight)
|
seenCommit := cs.blockStore.LoadSeenCommit(state.LastBlockHeight)
|
||||||
seenCommit.AddAddresses(cs.Validators.GetAddresses())
|
seenCommit.SetAddresses(cs.Validators.GetAddresses())
|
||||||
lastPrecommits := types.NewVoteSet(state.ChainID, state.LastBlockHeight, seenCommit.Round(), types.VoteTypePrecommit, state.LastValidators)
|
lastPrecommits := types.NewVoteSet(state.ChainID, state.LastBlockHeight, seenCommit.Round(), types.VoteTypePrecommit, state.LastValidators)
|
||||||
for idx := 0; idx < len(seenCommit.Precommits); idx++ {
|
for idx := 0; idx < len(seenCommit.Precommits); idx++ {
|
||||||
if seenCommit.Precommits[idx] == nil {
|
if seenCommit.Precommits[idx] == nil {
|
||||||
|
@ -294,6 +294,7 @@ func TestStateFullRoundNil(t *testing.T) {
|
|||||||
validatePrevoteAndPrecommit(t, cs, round, 0, vss[0], nil, nil)
|
validatePrevoteAndPrecommit(t, cs, round, 0, vss[0], nil, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tests that consensus state can be saved and reloaded from DB after committing a block.
|
||||||
func TestStateFullRound1Reload(t *testing.T) {
|
func TestStateFullRound1Reload(t *testing.T) {
|
||||||
blockDB := dbm.NewMemDB()
|
blockDB := dbm.NewMemDB()
|
||||||
state, privVals := randGenesisState(1, false, 10)
|
state, privVals := randGenesisState(1, false, 10)
|
||||||
|
@ -26,7 +26,7 @@ func BenchmarkRoundStateDeepCopy(b *testing.B) {
|
|||||||
sig := make([]byte, ed25519.SignatureSize)
|
sig := make([]byte, ed25519.SignatureSize)
|
||||||
for i := 0; i < nval; i++ {
|
for i := 0; i < nval; i++ {
|
||||||
precommits[i] = &types.CommitSig{
|
precommits[i] = &types.CommitSig{
|
||||||
Timestamp: time.Now(),
|
Timestamp: time.Now().UTC(),
|
||||||
Signature: sig,
|
Signature: sig,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ func BenchmarkRoundStateDeepCopy(b *testing.B) {
|
|||||||
block := &types.Block{
|
block := &types.Block{
|
||||||
Header: types.Header{
|
Header: types.Header{
|
||||||
ChainID: cmn.RandStr(12),
|
ChainID: cmn.RandStr(12),
|
||||||
Time: time.Now(),
|
Time: time.Now().UTC(),
|
||||||
LastBlockID: blockID,
|
LastBlockID: blockID,
|
||||||
LastCommitHash: cmn.RandBytes(20),
|
LastCommitHash: cmn.RandBytes(20),
|
||||||
DataHash: cmn.RandBytes(20),
|
DataHash: cmn.RandBytes(20),
|
||||||
@ -60,7 +60,7 @@ func BenchmarkRoundStateDeepCopy(b *testing.B) {
|
|||||||
parts := block.MakePartSet(4096)
|
parts := block.MakePartSet(4096)
|
||||||
// Random Proposal
|
// Random Proposal
|
||||||
proposal := &types.Proposal{
|
proposal := &types.Proposal{
|
||||||
Timestamp: time.Now(),
|
Timestamp: time.Now().UTC(),
|
||||||
BlockPartsHeader: types.PartSetHeader{
|
BlockPartsHeader: types.PartSetHeader{
|
||||||
Hash: cmn.RandBytes(20),
|
Hash: cmn.RandBytes(20),
|
||||||
},
|
},
|
||||||
@ -71,8 +71,8 @@ func BenchmarkRoundStateDeepCopy(b *testing.B) {
|
|||||||
// TODO: hvs :=
|
// TODO: hvs :=
|
||||||
|
|
||||||
rs := &RoundState{
|
rs := &RoundState{
|
||||||
StartTime: time.Now(),
|
StartTime: time.Now().UTC(),
|
||||||
CommitTime: time.Now(),
|
CommitTime: time.Now().UTC(),
|
||||||
Validators: vset,
|
Validators: vset,
|
||||||
Proposal: proposal,
|
Proposal: proposal,
|
||||||
ProposalBlock: block,
|
ProposalBlock: block,
|
||||||
|
@ -129,7 +129,7 @@ func (p *provider) fillFullCommit(signedHeader types.SignedHeader) (fc lite.Full
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return lite.FullCommit{}, err
|
return lite.FullCommit{}, err
|
||||||
}
|
}
|
||||||
signedHeader.Commit.AddAddresses(valset.GetAddresses())
|
signedHeader.Commit.SetAddresses(valset.GetAddresses())
|
||||||
|
|
||||||
return lite.NewFullCommit(signedHeader, valset, nextValset), nil
|
return lite.NewFullCommit(signedHeader, valset, nextValset), nil
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ func (dbp *DBProvider) fillFullCommit(sh types.SignedHeader) (FullCommit, error)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return FullCommit{}, err
|
return FullCommit{}, err
|
||||||
}
|
}
|
||||||
sh.Commit.AddAddresses(valset.GetAddresses())
|
sh.Commit.SetAddresses(valset.GetAddresses())
|
||||||
// Return filled FullCommit.
|
// Return filled FullCommit.
|
||||||
return FullCommit{
|
return FullCommit{
|
||||||
SignedHeader: sh,
|
SignedHeader: sh,
|
||||||
|
@ -384,7 +384,7 @@ func (commit *Commit) BitArray() *cmn.BitArray {
|
|||||||
return commit.bitArray
|
return commit.bitArray
|
||||||
}
|
}
|
||||||
|
|
||||||
func (commit *Commit) AddAddresses(addresses []Address) {
|
func (commit *Commit) SetAddresses(addresses []Address) {
|
||||||
commit.addresses = addresses
|
commit.addresses = addresses
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ func (vals *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, height i
|
|||||||
}
|
}
|
||||||
|
|
||||||
talliedVotingPower := int64(0)
|
talliedVotingPower := int64(0)
|
||||||
commit.AddAddresses(vals.GetAddresses())
|
commit.SetAddresses(vals.GetAddresses())
|
||||||
|
|
||||||
for idx, precommit := range commit.Precommits {
|
for idx, precommit := range commit.Precommits {
|
||||||
if precommit == nil {
|
if precommit == nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user