Open fxj-github opened 2 years ago
Hey, been digging into the code for the past few days and I also found this intriguing. I think the answer is that update
and the conditional logic gating the vote don't conflict with one another and so their ordering doesn't matter. Notice that in HotStuffCore::update
, we update the b_lock
to blk1
(ref), which is equal to bnew.justify.justify
, and as long blk1.height > b_lock.height
. However, the on_receive_proposal
condition checks whether bnew.justify.height
> b_lock.height
which would evaluate identically regardless of the update
since bnew.justify.height > blk1.height
.
I noticed in the latest paper's Event-driven code, Update() called after sending vote. But in libhotstuff code, Update() called before sending vote. I'm confused as Update() may update lock and sending vote depends on lock. So which is correct? Or both can be correct? Thanks.