Skip to content

Commit a78c324

Browse files
Ensure one of each
Co-authored-by: Matthew McPherrin <github@mcpherrin.ca> Co-authored-by: Aaron Gable <aaron@aarongable.com>
1 parent b9c88cb commit a78c324

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

ctpolicy/loglist/loglist.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,19 +227,19 @@ func (ll List) ForTime(expiry time.Time) List {
227227
}
228228

229229
// Shuffle returns a new log list containing the exact same logs, but in a
230-
// nearly-randomly-shuffled order. If possible, it ensures that one of the first
231-
// two logs is a static-ct-api log, to boost the percentage of certs which
232-
// include an SCT from a static log.
230+
// nearly-randomly-shuffled order. If possible, it ensures that the first two
231+
// logs consist of one tiled log and one non-tiled log, to boost the percentage
232+
// of certs which include an SCT from a static log.
233233
func (ll List) Shuffle() List {
234234
res := slices.Clone(ll)
235235
rand.Shuffle(len(res), func(i int, j int) {
236236
res[i], res[j] = res[j], res[i]
237237
})
238-
if len(res) > 2 && !res[0].Tiled && !res[1].Tiled {
239-
// If we have more than two logs, and neither of the first two are tiled,
240-
// try to bring a tiled log to the front of the list.
238+
if len(res) > 2 && res[0].Tiled == res[1].Tiled {
239+
// If we have more than two logs, and both are either tiled or not,
240+
// try to bring another log to the front of the list.
241241
for i := 2; i < len(res); i++ {
242-
if res[i].Tiled {
242+
if res[0].Tiled != res[i].Tiled {
243243
res[0], res[i] = res[i], res[0]
244244
break
245245
}

0 commit comments

Comments
 (0)