ForwardingService: make use of null-safe Objects.equals()

This commit is contained in:
Sean Gilligan 2023-08-25 14:41:33 -07:00 committed by Andreas Schildbach
parent 111a8b8a37
commit 0bd5ed9b9b

View file

@ -34,6 +34,7 @@ import org.bitcoinj.wallet.listeners.WalletCoinsReceivedEventListener;
import java.io.Closeable; import java.io.Closeable;
import java.io.File; import java.io.File;
import java.util.Objects;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import static java.util.stream.Collectors.collectingAndThen; import static java.util.stream.Collectors.collectingAndThen;
@ -193,7 +194,7 @@ public class ForwardingService implements Closeable {
*/ */
static CoinSelector forwardingCoinSelector(Sha256Hash parentTxId) { static CoinSelector forwardingCoinSelector(Sha256Hash parentTxId) {
return (target, candidates) -> candidates.stream() return (target, candidates) -> candidates.stream()
.filter(output -> output.getParentTransactionHash() != null && output.getParentTransactionHash().equals(parentTxId)) .filter(output -> Objects.equals(output.getParentTransactionHash(), parentTxId))
.collect(collectingAndThen(toList(), CoinSelection::new)); .collect(collectingAndThen(toList(), CoinSelection::new));
} }
} }