File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed
consensus/hotstuff/votecollector Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -390,6 +390,7 @@ func (m *VoteCollector) caching2Verifying(proposal *model.SignedProposal) error
390390 // to `VoteCollectorStatusVerifying` is possible only if the current state is `VoteCollectorStatusCaching`. Once the state changed
391391 // away from `VoteCollectorStatusCaching` it can never return to this state. I.e. if condition (i) failed once, it can never be
392392 // satisfied later. Step (ii) failing implies that condition (i) was previously true, but no longer holds.
393+ // Since we are storing a pointer in the atomic.Value the value compared will be the reference to the object.
393394 currentProcWrapper := m .votesProcessor .Load ().(* atomicValueWrapper )
394395 currentState := currentProcWrapper .processor .Status () // must use same object here as in CAS below (_not_ a fresh load from `m.Status()`)
395396 if currentState != hotstuff .VoteCollectorStatusCaching {
@@ -423,6 +424,7 @@ func (m *VoteCollector) terminateVoteProcessing() {
423424 // Note that (i) and (ii) are separate operations. However, the CAS in (ii) ensures that the write only happens if the current state
424425 // is still the same as what we observed in (i). If another thread changed the state in between (i) and (ii), we have worked with
425426 // an outdated view of the current state, and should repeat the attempt to update the state (hence the "loop" in CAS LOOP).
427+ // Since we are storing a pointer in the atomic.Value the value compared will be the reference to the object.
426428 for {
427429 stateUpdateSuccessful := m .votesProcessor .CompareAndSwap (currentProcWrapper , newProcWrapper )
428430 if stateUpdateSuccessful {
You can’t perform that action at this time.
0 commit comments