diff options
-rw-r--r-- | core/lattice.go | 8 | ||||
-rw-r--r-- | core/total-ordering.go | 16 |
2 files changed, 12 insertions, 12 deletions
diff --git a/core/lattice.go b/core/lattice.go index 4c53352..4642820 100644 --- a/core/lattice.go +++ b/core/lattice.go @@ -256,11 +256,11 @@ func (l *Lattice) ProcessBlock( if len(toDelivered) == 0 { break } - hashes := make(common.Hashes, len(toDelivered)) - for idx := range toDelivered { - hashes[idx] = toDelivered[idx].Hash - } if l.debug != nil { + hashes := make(common.Hashes, len(toDelivered)) + for idx := range toDelivered { + hashes[idx] = toDelivered[idx].Hash + } l.debug.TotalOrderingDelivered(hashes, deliveredMode) } // Perform consensus timestamp module. diff --git a/core/total-ordering.go b/core/total-ordering.go index de8dd0b..2e2158e 100644 --- a/core/total-ordering.go +++ b/core/total-ordering.go @@ -652,12 +652,14 @@ func (global *totalOrderingGlobalVector) addBlock( return } // Add breakpoint. - global.breakpoints[chainID] = append( - global.breakpoints[chainID], - &totalOrderingBreakpoint{ - roundID: b.Position.Round, - lastHeight: tip.Position.Height, - }) + if b.Position.Round > global.curRound { + global.breakpoints[chainID] = append( + global.breakpoints[chainID], + &totalOrderingBreakpoint{ + roundID: b.Position.Round, + lastHeight: tip.Position.Height, + }) + } } else { if b.Position.Height != tip.Position.Height+1 { err = ErrInvalidDAG @@ -1052,7 +1054,6 @@ func (to *totalOrdering) generateDeliverSet() ( wg.Wait() // Reset dirty chains. to.dirtyChainIDs = to.dirtyChainIDs[:0] - // TODO(mission): ANS should be bounded by current numChains. globalAnsLength := globalInfo.getAckingNodeSetLength( globalInfo, cfg.k, cfg.numChains) CheckNextCandidateLoop: @@ -1126,7 +1127,6 @@ CheckNextCandidateLoop: checkANS := func() bool { var chainAnsLength uint64 for p := range precedings { - // TODO(mission): ANS should be bound by current numChains. chainAnsLength = to.candidates[p].getAckingNodeSetLength( globalInfo, cfg.k, cfg.numChains) if uint64(chainAnsLength) < uint64(cfg.numChains)-cfg.phi { |