fix block hash in new view

pull/3411/head
Rongjian Lan 4 years ago
parent c270381a9f
commit 61edc85a90
  1. 3
      consensus/view_change.go

@ -316,6 +316,7 @@ func (consensus *Consensus) startNewView(viewID uint64, newLeaderPriKey *bls.Pri
Str("myKey", newLeaderPriKey.Pub.Bytes.Hex()). Str("myKey", newLeaderPriKey.Pub.Bytes.Hex()).
Msg("[startNewView] viewChange stopped. I am the New Leader") Msg("[startNewView] viewChange stopped. I am the New Leader")
consensus.ResetState()
consensus.LeaderPubKey = newLeaderPriKey.Pub consensus.LeaderPubKey = newLeaderPriKey.Pub
return nil return nil
@ -407,6 +408,8 @@ func (consensus *Consensus) onViewChange(msg *msg_pb.Message) {
consensus.getLogger().Error().Err(err).Msg("[onViewChange] startNewView failed") consensus.getLogger().Error().Err(err).Msg("[onViewChange] startNewView failed")
return return
} }
// Have to keep the block hash so the leader can finish the commit phase of prepared block
copy(consensus.blockHash[:], payload[:32])
} }
} }

Loading…
Cancel
Save