CoinSelection: add defensive copy in constructor

This commit is contained in:
Sean Gilligan 2023-09-05 19:24:54 -07:00 committed by Andreas Schildbach
parent e8491bbd88
commit 82feb7b831

View file

@ -21,6 +21,7 @@ import org.bitcoinj.core.TransactionOutput;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
@ -42,7 +43,7 @@ public class CoinSelection {
public CoinSelection(List<TransactionOutput> gathered) { public CoinSelection(List<TransactionOutput> gathered) {
this.valueGathered = sumOutputValues(gathered); this.valueGathered = sumOutputValues(gathered);
this.gathered = gathered; this.gathered = Collections.unmodifiableList(new ArrayList<>(gathered));
} }
/** /**