diff --git a/consensus/metrics.go b/consensus/metrics.go index dc9f1d693..4e9ebe98c 100644 --- a/consensus/metrics.go +++ b/consensus/metrics.go @@ -258,7 +258,7 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics { Subsystem: MetricsSubsystem, Name: "duplicate_vote_receive", Help: "Number of votes received multiple times from the same peer by peer", - }, append(labels, "peer_id")).With(labelsAndValues...), + }, append(labels, "peer_id", "type")).With(labelsAndValues...), } } diff --git a/consensus/reactor.go b/consensus/reactor.go index c7ff8bc97..138479a64 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -351,7 +351,7 @@ func (conR *Reactor) ReceiveEnvelope(e p2p.Envelope) { duplicate := ps.SetReceivedVote(msg.Vote) if duplicate { - conR.Metrics.DuplicateVoteReceive.With("peer_id", string(e.Src.ID())).Add(1) + conR.Metrics.DuplicateVoteReceive.With("peer_id", string(e.Src.ID()), "type", msg.Vote.Type.String()).Add(1) } cs.peerMsgQueue <- msgInfo{msg, e.Src.ID()} diff --git a/libs/bits/bit_array.go b/libs/bits/bit_array.go index 9d6901460..d3aa2a444 100644 --- a/libs/bits/bit_array.go +++ b/libs/bits/bit_array.go @@ -19,6 +19,8 @@ type BitArray struct { Elems []uint64 `json:"elems"` // NOTE: persisted via reflect, must be exported } +// New bit array creates a bit array where all of the bits are initially 'false' +// // NewBitArray returns a new bit array. // It returns nil if the number of bits is zero. func NewBitArray(bits int) *BitArray { @@ -39,6 +41,8 @@ func (bA *BitArray) Size() int { return bA.Bits } +// The bit array represents true as 1 and false as 0 +// // GetIndex returns the bit at index i within the bit array. // The behavior is undefined if i >= bA.Bits func (bA *BitArray) GetIndex(i int) bool {