/** * Try to apply the status state */ private void tryToApplyState(AddressStatus status) { lock.lock(); try { if (statusPendingUpdates.containsKey(status.getAddress())) { if (status.isUnspentTxQueued() && !status.isUnspentTxStateApplied()) { Set<Sha256Hash> txHashes = status.getUnspentTxHashes(); HashMap<Sha256Hash, BitTransaction> txs = getTransactions(txHashes); // We have all the transactions, apply state if (txs.size() == txHashes.size()) { applyUnspentState(status, txs); } } if (status.isHistoryTxQueued() && !status.isHistoryTxStateApplied()) { Set<Sha256Hash> txHashes = status.getHistoryTxHashes(); HashMap<Sha256Hash, BitTransaction> txs = getTransactions(txHashes); // We have all the transactions, apply state if (txs.size() == txHashes.size()) { applyHistoryState(status, txs); } } } } finally { lock.unlock(); } }