@@ -214,7 +214,7 @@ func (t *TipSelection) likedInsteadReferences(likedConflicts ds.Set[iotago.Trans
214
214
return references , updatedLikedConflicts , nil
215
215
}
216
216
217
- // collectReferences collects tips from a tip selector (and calls the callback for each tip) until the amount of
217
+ // collectReferences collects tips from a tip selector (and calls the callback for each tip) until the number of
218
218
// references of the given type is reached.
219
219
func (t * TipSelection ) collectReferences (callback func (tipmanager.TipMetadata ), tipSelectorsAmount ... * types.Tuple [func (optAmount ... int ) []tipmanager.TipMetadata , int ]) {
220
220
seenTips := ds .NewSet [iotago.BlockID ]()
@@ -236,9 +236,14 @@ func (t *TipSelection) collectReferences(callback func(tipmanager.TipMetadata),
236
236
return uniqueTips
237
237
}
238
238
239
- // We select the desired amount of tips from all given tip selectors, respectively.
239
+ accumulatedTipAmount := 0
240
+ // We select the desired number of tips from all given tip selectors, respectively.
240
241
for _ , tipSelectorAmount := range tipSelectorsAmount {
241
- for tipCandidates := selectUniqueTips (tipSelectorAmount .A , tipSelectorAmount .B ); len (tipCandidates ) != 0 ; tipCandidates = selectUniqueTips (tipSelectorAmount .A , tipSelectorAmount .B ) {
242
+ // Make sure we select the total number of unique tips and not just the number of tips from the given tip pool,
243
+ // because of how selectUniqueTips works.
244
+ accumulatedTipAmount += tipSelectorAmount .B
245
+
246
+ for tipCandidates := selectUniqueTips (tipSelectorAmount .A , accumulatedTipAmount ); len (tipCandidates ) != 0 ; tipCandidates = selectUniqueTips (tipSelectorAmount .A , accumulatedTipAmount ) {
242
247
for _ , tip := range tipCandidates {
243
248
callback (tip )
244
249
}
0 commit comments