@Override public void beginDatabaseBatchWrite() throws BlockStoreException { // This is often called twice in row! But they are not nested // transactions! // We just ignore the second call. if (!autoCommit) { return; } if (instrument) beginMethod("beginDatabaseBatchWrite"); batch = db.createWriteBatch(); uncommited = new HashMap<ByteBuffer, byte[]>(); uncommitedDeletes = new HashSet<ByteBuffer>(); utxoUncommittedCache = new HashMap<ByteBuffer, UTXO>(); utxoUncommittedDeletedCache = new HashSet<ByteBuffer>(); autoCommit = false; if (instrument) endMethod("beginDatabaseBatchWrite"); }
/** * 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; }
protected void onResult(final Set<UTXO> utxos) { callbackHandler.post(new Runnable() { @Override public void run() { resultCallback.onResult(utxos); } }); }
/** * 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; }
/** * Construct a free standing Transaction Output. * @param params The network parameters. * @param output The stored output (free standing). */ public FreeStandingTransactionOutput(NetworkParameters params, UTXO output, int chainHeight) { super(params, null, output.getValue(), output.getScript().getProgram()); this.output = output; this.chainHeight = chainHeight; }
@Override protected boolean removeEldestEntry(Map.Entry<ByteBuffer, UTXO> eldest) { return size() > this.capacity; }
/** * Get the {@link UTXO}. * @return The stored output. */ public UTXO getUTXO() { return output; }
/** * Construct a free standing Transaction Output. * * @param params The network parameters. * @param output The stored output (free standing). */ public BsqUtxoTransactionOutput(NetworkParameters params, UTXO output, int chainHeight) { super(params, null, output.getValue(), output.getScript().getProgram()); this.output = output; this.chainHeight = chainHeight; }
/** * Get the {@link UTXO}. * * @return The stored output. */ public UTXO getUTXO() { return output; }
void onResult(Set<UTXO> utxos);