Fix minor issues for review
This commit is contained in:
parent
0cb37d424f
commit
632ac41d79
|
@ -550,12 +550,10 @@ func makeBlockchainFromWAL(wal WAL) ([]*types.Block, []*types.Commit, error) {
|
|||
if p.Type == types.VoteTypePrecommit {
|
||||
thisBlockCommit = &types.Commit{
|
||||
BlockID: p.BlockID,
|
||||
Precommits: []*types.CommitSig{
|
||||
&types.CommitSig{
|
||||
Signature: p.Signature,
|
||||
Timestamp: p.Timestamp,
|
||||
},
|
||||
},
|
||||
Precommits: []*types.CommitSig{{
|
||||
Signature: p.Signature,
|
||||
Timestamp: p.Timestamp,
|
||||
}},
|
||||
HeightNum: p.Height,
|
||||
RoundNum: p.Round,
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ func (pkz privKeys) ToValidators(init, inc int64) *types.ValidatorSet {
|
|||
|
||||
// signHeader properly signs the header with all keys from first to last exclusive.
|
||||
func (pkz privKeys) signHeader(header *types.Header, first, last int) *types.Commit {
|
||||
cs := make([]*types.CommitSig, len(pkz))
|
||||
commitSigs := make([]*types.CommitSig, len(pkz))
|
||||
|
||||
// We need this list to keep the ordering.
|
||||
vset := pkz.ToValidators(1, 0)
|
||||
|
@ -79,7 +79,7 @@ func (pkz privKeys) signHeader(header *types.Header, first, last int) *types.Com
|
|||
// Fill in the votes we want.
|
||||
for i := first; i < last && i < len(pkz); i++ {
|
||||
vote := makeVote(header, vset, pkz[i])
|
||||
cs[vote.ValidatorIndex] = &types.CommitSig{
|
||||
commitSigs[vote.ValidatorIndex] = &types.CommitSig{
|
||||
Signature: vote.Signature,
|
||||
Timestamp: vote.Timestamp,
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ func (pkz privKeys) signHeader(header *types.Header, first, last int) *types.Com
|
|||
|
||||
res := &types.Commit{
|
||||
BlockID: types.BlockID{Hash: header.Hash()},
|
||||
Precommits: cs,
|
||||
Precommits: commitSigs,
|
||||
RoundNum: 1,
|
||||
HeightNum: header.Height,
|
||||
}
|
||||
|
|
|
@ -311,13 +311,13 @@ type CommitSig struct {
|
|||
Timestamp time.Time
|
||||
}
|
||||
|
||||
func (cs *CommitSig) String(index int, address Address, height int64, round int, blockID BlockID) string {
|
||||
func (commitSig *CommitSig) String(index int, address Address, height int64, round int, blockID BlockID) string {
|
||||
return fmt.Sprintf("Vote{%v:%X %v/%02d/%v(%v) %X %X @ %s}",
|
||||
index, cmn.Fingerprint(address),
|
||||
height, round, VoteTypePrecommit, "Precommit",
|
||||
cmn.Fingerprint(blockID.Hash),
|
||||
cmn.Fingerprint(cs.Signature),
|
||||
CanonicalTime(cs.Timestamp))
|
||||
cmn.Fingerprint(commitSig.Signature),
|
||||
CanonicalTime(commitSig.Timestamp))
|
||||
}
|
||||
|
||||
// Height returns the height of the commit
|
||||
|
@ -357,15 +357,15 @@ func (commit *Commit) BitArray() *cmn.BitArray {
|
|||
}
|
||||
|
||||
// GetByIndex returns the vote corresponding to a given validator index
|
||||
func (com *Commit) GetByIndex(index int) *Vote {
|
||||
func (commit *Commit) GetByIndex(index int) *Vote {
|
||||
return &Vote{
|
||||
ValidatorIndex: index,
|
||||
Height: com.HeightNum,
|
||||
Round: com.RoundNum,
|
||||
Timestamp: com.Precommits[index].Timestamp,
|
||||
Height: commit.HeightNum,
|
||||
Round: commit.RoundNum,
|
||||
Timestamp: commit.Precommits[index].Timestamp,
|
||||
Type: VoteTypePrecommit,
|
||||
BlockID: com.BlockID,
|
||||
Signature: com.Precommits[index].Signature,
|
||||
BlockID: commit.BlockID,
|
||||
Signature: commit.Precommits[index].Signature,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue