dont add inputs with negative effective value when calculating max value

This commit is contained in:
Craig Raw 2021-04-26 14:27:08 +02:00
parent cc6e3ffdc2
commit 63394b142c

View file

@ -6,6 +6,6 @@ import java.util.stream.Collectors;
public class MaxUtxoSelector implements UtxoSelector {
@Override
public Collection<BlockTransactionHashIndex> select(long targetValue, Collection<OutputGroup> candidates) {
return candidates.stream().flatMap(outputGroup -> outputGroup.getUtxos().stream()).collect(Collectors.toUnmodifiableList());
return candidates.stream().filter(outputGroup -> outputGroup.getEffectiveValue() >= 0).flatMap(outputGroup -> outputGroup.getUtxos().stream()).collect(Collectors.toUnmodifiableList());
}
}