Browse Source

autopilot: append instead of appends in a loop

master
Andras Banki-Horvath 4 years ago
parent
commit
0679d1dd4b
  1. 5
      autopilot/agent.go
  2. 5
      autopilot/choice_test.go

5
autopilot/agent.go

@ -386,9 +386,8 @@ func mergeChanState(pendingChans map[NodeID]Channel,
numChans := len(pendingChans) + len(activeChans)
totalChans := make([]Channel, 0, numChans)
for _, activeChan := range activeChans.Channels() {
totalChans = append(totalChans, activeChan)
}
totalChans = append(totalChans, activeChans.Channels()...)
for _, pendingChan := range pendingChans {
totalChans = append(totalChans, pendingChan)
}

5
autopilot/choice_test.go

@ -139,10 +139,7 @@ func assertChoice(w []float64, iterations int) bool {
}
// The sum of choices must be exactly iterations of course.
if totalChoices != iterations {
return false
}
return true
return totalChoices == iterations
}

Loading…
Cancel
Save