Skip to content

Commit

Permalink
Use >= for LI AOs as well instead of ==.
Browse files Browse the repository at this point in the history
  • Loading branch information
kape1395 committed Feb 3, 2023
1 parent d71449b commit 0b647a7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/chain/cmtLog/var_log_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ func (v *varLogIndexImpl) MsgNextLogIndexReceived(msg *msgNextLogIndex) gpa.OutM
//
// Proceed to the next log index, if needed.
newLogIndex, newAO := v.votedFor(v.n - v.f)
v.log.Debugf("supportLogIndex=%v, newLogIndex=%v, logIndex=%v", supportLogIndex, newLogIndex, v.logIndex)
v.log.Debugf(
"supportLogIndex=%v, newLogIndex=%v, v.logIndex=%v, v.sentNextLI=%v supportAO=%v",
supportLogIndex, newLogIndex, v.logIndex, v.sentNextLI, supportAO.String(),
)
if newLogIndex > v.logIndex {
v.logIndex = newLogIndex
v.latestAO = newAO
Expand Down Expand Up @@ -209,7 +212,7 @@ func (v *varLogIndexImpl) votedFor(quorum int) (LogIndex, *isc.AliasOutputWithID
countsAOMap := map[iotago.OutputID]*isc.AliasOutputWithID{}
countsAO := map[iotago.OutputID]int{}
for _, msg := range v.maxPeerLIs {
if msg.nextLogIndex != maxLI {
if msg.nextLogIndex < maxLI {
continue
}
countsAOMap[msg.nextBaseAO.OutputID()] = msg.nextBaseAO
Expand All @@ -236,14 +239,14 @@ func (v *varLogIndexImpl) maybeSendNextLogIndex(logIndex LogIndex, baseAO *isc.A
if v.sentNextLI.AsUint32() >= logIndex.AsUint32() {
return nil
}
if v.latestAO == nil {
if baseAO == nil {
return nil
}
v.sentNextLI = logIndex
msgs := gpa.NoMessages()
for i := range v.nodeIDs {
msgs.Add(newMsgNextLogIndex(v.nodeIDs[i], logIndex, baseAO))
}
v.log.Debugf("Sending NextLogIndex=%v, latestAO=%v", logIndex, baseAO)
v.log.Debugf("Sending NextLogIndex=%v, baseAO=%v", logIndex, baseAO)
return msgs
}

0 comments on commit 0b647a7

Please sign in to comment.