/** * Get all the {@link UTXO}'s from the {@link UTXOProvider} based on keys that the * wallet contains. * @return The list of stored outputs. */ protected List<UTXO> getStoredOutputsFromUTXOProvider() throws UTXOProviderException { UTXOProvider utxoProvider = checkNotNull(vUTXOProvider, "No UTXO provider has been set"); List<UTXO> candidates = new ArrayList<>(); List<ECKey> keys = getImportedKeys(); keys.addAll(getActiveKeyChain().getLeafKeys()); List<Address> addresses = new ArrayList<>(); for (ECKey key : keys) { Address address = new Address(params, key.getPubKeyHash()); addresses.add(address); } candidates.addAll(utxoProvider.getOpenTransactionOutputs(addresses)); return candidates; }
/** * Get the {@link UTXOProvider}. * @return The UTXO provider. */ @Nullable public UTXOProvider getUTXOProvider() { lock.lock(); try { return vUTXOProvider; } finally { lock.unlock(); } }
/** * Set the {@link UTXOProvider}. * * <p>The wallet will query the provider for spendable candidates, i.e. outputs controlled exclusively * by private keys contained in the wallet.</p> * * <p>Note that the associated provider must be reattached after a wallet is loaded from disk. * The association is not serialized.</p> */ public void setUTXOProvider(@Nullable UTXOProvider provider) { lock.lock(); try { checkArgument(provider == null || provider.getParams().equals(params)); this.vUTXOProvider = provider; } finally { lock.unlock(); } }
/** * Get all the {@link UTXO}'s from the {@link UTXOProvider} based on keys that the * wallet contains. * @return The list of stored outputs. */ protected List<UTXO> getStoredOutputsFromUTXOProvider() throws UTXOProviderException { UTXOProvider utxoProvider = checkNotNull(vUTXOProvider, "No UTXO provider has been set"); List<UTXO> candidates = new ArrayList<UTXO>(); List<ECKey> keys = getImportedKeys(); keys.addAll(getActiveKeyChain().getLeafKeys()); List<Address> addresses = new ArrayList<Address>(); for (ECKey key : keys) { Address address = new Address(params, key.getPubKeyHash()); addresses.add(address); } candidates.addAll(utxoProvider.getOpenTransactionOutputs(addresses)); return candidates; }