Package org.bitcoinj.wallet
Class DefaultCoinSelector
java.lang.Object
org.bitcoinj.wallet.DefaultCoinSelector
- All Implemented Interfaces:
 CoinSelector
- Direct Known Subclasses:
 AllowUnconfirmedCoinSelector
This class implements a 
CoinSelector which attempts to get the highest priority
 possible. This means that the transaction is the most likely to get confirmed. Note that this means we may end up
 "spending" more priority than would be required to get the transaction we are creating confirmed.- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic intComparator for sortingTransactionOutputby coin depth, value, and then hash.static CoinSelectorstatic booleanisSelectable(Transaction tx, Network network) Helper to determine if this selector would select a given transaction.select(Coin target, List<TransactionOutput> candidates) Creates a CoinSelection that tries to meet the target amount of value.protected booleanSub-classes can override this to just customize whether transactions are usable, but keep age sorting. 
- 
Constructor Details
- 
DefaultCoinSelector
protected DefaultCoinSelector() 
 - 
 - 
Method Details
- 
select
Description copied from interface:CoinSelectorCreates 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.- Specified by:
 selectin interfaceCoinSelector
 - 
compareByDepth
Comparator for sortingTransactionOutputby coin depth, value, and then hash.- Parameters:
 a- The first object to be comparedb- The second object to be compared- Returns:
 - a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
 
 - 
shouldSelect
Sub-classes can override this to just customize whether transactions are usable, but keep age sorting. - 
isSelectable
Helper to determine if this selector would select a given transaction. Note that in a regtest network outgoing payments will likely not see propagation, so there is a special exception.- Parameters:
 tx- transaction to determine if it would be selectednetwork- network the transaction is on- Returns:
 - true if it would be selected, false otherwise
 
 - 
get
 
 -