From 61edc85a90f33291921e6762460896b3f6dd4b4d Mon Sep 17 00:00:00 2001 From: Rongjian Lan Date: Mon, 26 Oct 2020 12:01:02 -0700 Subject: [PATCH] fix block hash in new view --- consensus/view_change.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/consensus/view_change.go b/consensus/view_change.go index 632069821..0383ac1ee 100644 --- a/consensus/view_change.go +++ b/consensus/view_change.go @@ -316,6 +316,7 @@ func (consensus *Consensus) startNewView(viewID uint64, newLeaderPriKey *bls.Pri Str("myKey", newLeaderPriKey.Pub.Bytes.Hex()). Msg("[startNewView] viewChange stopped. I am the New Leader") + consensus.ResetState() consensus.LeaderPubKey = newLeaderPriKey.Pub return nil @@ -407,6 +408,8 @@ func (consensus *Consensus) onViewChange(msg *msg_pb.Message) { consensus.getLogger().Error().Err(err).Msg("[onViewChange] startNewView failed") return } + // Have to keep the block hash so the leader can finish the commit phase of prepared block + copy(consensus.blockHash[:], payload[:32]) } }