Skip to content

Commit 66b3357

Browse files
committed
Updated godoc
1 parent b9b9d2a commit 66b3357

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

consensus/hotstuff/votecollector/statemachine.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)