diff --git a/chain/metrics/consensus.go b/chain/metrics/consensus.go index e8f0d7c87..b0352860e 100644 --- a/chain/metrics/consensus.go +++ b/chain/metrics/consensus.go @@ -71,6 +71,7 @@ type message struct { Height uint64 Weight types.BigInt Time uint64 + Nonce uint64 // Meta @@ -86,6 +87,9 @@ func sendHeadNotifs(ctx context.Context, ps *pubsub.PubSub, topic string, chain return err } + // using unix nano time makes very sure we pick a nonce higher than previous restart + nonce := uint64(time.Now().UnixNano()) + for { select { case notif := <-notifs: @@ -103,6 +107,7 @@ func sendHeadNotifs(ctx context.Context, ps *pubsub.PubSub, topic string, chain Weight: w, NodeName: nickname, Time: uint64(time.Now().UnixNano() / 1000_000), + Nonce: nonce, } b, err := json.Marshal(m) @@ -116,5 +121,7 @@ func sendHeadNotifs(ctx context.Context, ps *pubsub.PubSub, topic string, chain case <-ctx.Done(): return nil } + + nonce++ } }