uint64 height (Refs #911)

This commit is contained in:
Anton Kaliaev
2017-11-30 13:08:38 -06:00
committed by Ethan Buchman
parent b2489b4318
commit b3492356e6
64 changed files with 296 additions and 270 deletions

View File

@ -861,7 +861,7 @@ func (ps *PeerState) GetRoundState() *cstypes.PeerRoundState {
// GetHeight returns an atomic snapshot of the PeerRoundState's height
// used by the mempool to ensure peers are caught up before broadcasting new txs
func (ps *PeerState) GetHeight() int {
func (ps *PeerState) GetHeight() uint64 {
ps.mtx.Lock()
defer ps.mtx.Unlock()
return ps.PeerRoundState.Height
@ -900,7 +900,7 @@ func (ps *PeerState) InitProposalBlockParts(partsHeader types.PartSetHeader) {
}
// SetHasProposalBlockPart sets the given block part index as known for the peer.
func (ps *PeerState) SetHasProposalBlockPart(height int, round int, index int) {
func (ps *PeerState) SetHasProposalBlockPart(height uint64, round int, index int) {
ps.mtx.Lock()
defer ps.mtx.Unlock()
@ -951,7 +951,7 @@ func (ps *PeerState) PickVoteToSend(votes types.VoteSetReader) (vote *types.Vote
return nil, false
}
func (ps *PeerState) getVoteBitArray(height, round int, type_ byte) *cmn.BitArray {
func (ps *PeerState) getVoteBitArray(height uint64, round int, type_ byte) *cmn.BitArray {
if !types.IsVoteTypeValid(type_) {
return nil
}
@ -998,7 +998,7 @@ func (ps *PeerState) getVoteBitArray(height, round int, type_ byte) *cmn.BitArra
}
// 'round': A round for which we have a +2/3 commit.
func (ps *PeerState) ensureCatchupCommitRound(height, round int, numValidators int) {
func (ps *PeerState) ensureCatchupCommitRound(height uint64, round int, numValidators int) {
if ps.Height != height {
return
}
@ -1024,13 +1024,13 @@ func (ps *PeerState) ensureCatchupCommitRound(height, round int, numValidators i
// what votes this peer has received.
// NOTE: It's important to make sure that numValidators actually matches
// what the node sees as the number of validators for height.
func (ps *PeerState) EnsureVoteBitArrays(height int, numValidators int) {
func (ps *PeerState) EnsureVoteBitArrays(height uint64, numValidators int) {
ps.mtx.Lock()
defer ps.mtx.Unlock()
ps.ensureVoteBitArrays(height, numValidators)
}
func (ps *PeerState) ensureVoteBitArrays(height int, numValidators int) {
func (ps *PeerState) ensureVoteBitArrays(height uint64, numValidators int) {
if ps.Height == height {
if ps.Prevotes == nil {
ps.Prevotes = cmn.NewBitArray(numValidators)
@ -1059,7 +1059,7 @@ func (ps *PeerState) SetHasVote(vote *types.Vote) {
ps.setHasVote(vote.Height, vote.Round, vote.Type, vote.ValidatorIndex)
}
func (ps *PeerState) setHasVote(height int, round int, type_ byte, index int) {
func (ps *PeerState) setHasVote(height uint64, round int, type_ byte, index int) {
logger := ps.logger.With("peerH/R", cmn.Fmt("%d/%d", ps.Height, ps.Round), "H/R", cmn.Fmt("%d/%d", height, round))
logger.Debug("setHasVote", "type", type_, "index", index)
@ -1253,7 +1253,7 @@ func DecodeMessage(bz []byte) (msgType byte, msg ConsensusMessage, err error) {
// NewRoundStepMessage is sent for every step taken in the ConsensusState.
// For every height/round/step transition
type NewRoundStepMessage struct {
Height int
Height uint64
Round int
Step cstypes.RoundStepType
SecondsSinceStartTime int
@ -1270,7 +1270,7 @@ func (m *NewRoundStepMessage) String() string {
// CommitStepMessage is sent when a block is committed.
type CommitStepMessage struct {
Height int
Height uint64
BlockPartsHeader types.PartSetHeader
BlockParts *cmn.BitArray
}
@ -1296,7 +1296,7 @@ func (m *ProposalMessage) String() string {
// ProposalPOLMessage is sent when a previous proposal is re-proposed.
type ProposalPOLMessage struct {
Height int
Height uint64
ProposalPOLRound int
ProposalPOL *cmn.BitArray
}
@ -1310,7 +1310,7 @@ func (m *ProposalPOLMessage) String() string {
// BlockPartMessage is sent when gossipping a piece of the proposed block.
type BlockPartMessage struct {
Height int
Height uint64
Round int
Part *types.Part
}
@ -1336,7 +1336,7 @@ func (m *VoteMessage) String() string {
// HasVoteMessage is sent to indicate that a particular vote has been received.
type HasVoteMessage struct {
Height int
Height uint64
Round int
Type byte
Index int
@ -1351,7 +1351,7 @@ func (m *HasVoteMessage) String() string {
// VoteSetMaj23Message is sent to indicate that a given BlockID has seen +2/3 votes.
type VoteSetMaj23Message struct {
Height int
Height uint64
Round int
Type byte
BlockID types.BlockID
@ -1366,7 +1366,7 @@ func (m *VoteSetMaj23Message) String() string {
// VoteSetBitsMessage is sent to communicate the bit-array of votes seen for the BlockID.
type VoteSetBitsMessage struct {
Height int
Height uint64
Round int
Type byte
BlockID types.BlockID