Package org.bitcoinj.wallet
Interface CoinSelector
-
- All Known Implementing Classes:
AllowUnconfirmedCoinSelector
,DefaultCoinSelector
,FilteringCoinSelector
,KeyTimeCoinSelector
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface CoinSelector
A CoinSelector is responsible for picking some outputs to spend, from the list of all possible outputs. It allows you to customize the policies for creation of transactions to suit your needs. The select operation may return aCoinSelection
that has a valueGathered lower than the requested target, if there's not enough money in the wallet.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static CoinSelector
fromPredicate(java.util.function.Predicate<TransactionOutput> predicate)
Create aCoinSelector
from a predicate function that filters a singleTransactionOutput
CoinSelection
select(Coin target, java.util.List<TransactionOutput> candidates)
Creates a CoinSelection that tries to meet the target amount of value.
-
-
-
Method Detail
-
select
CoinSelection select(Coin target, java.util.List<TransactionOutput> candidates)
Creates a CoinSelection that tries to meet the target amount of value. The candidates list is given to this call and can be edited freely. See the docs for CoinSelection to learn more, or look a the implementation ofDefaultCoinSelector
.
-
fromPredicate
static CoinSelector fromPredicate(java.util.function.Predicate<TransactionOutput> predicate)
Create aCoinSelector
from a predicate function that filters a singleTransactionOutput
- Parameters:
predicate
- Returns true if a "coin" (TransactionOutput
) should be included.- Returns:
- A CoinSelector that only returns coins matching the predicate
-
-