Created
December 20, 2016 13:21
-
-
Save davassi/71b121ab6f82629adf057388edebd011 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void findAllUnconfirmedTransactions() { | |
synchronized (StorageScratchpad.instance().getAnalyzedTransactionsFlags()) { | |
// get the hash of the last milestone. | |
final Hash milestone = Milestone.getHashOfLastMilestoneIndex(); | |
if (milestone != null) { | |
// get the trunk transaction hash | |
long pointer = StorageTransactions.instance().transactionPointer(milestone.bytes()); | |
final Transaction transaction = StorageTransactions.instance().loadTransaction(pointer); | |
log.info("Trunk Transaction hash of last milestone: {}", transaction.trunkTransaction); | |
final List<Transaction> trx = findAllTransactionsChainedTo(pointer, transaction.trunkTransaction); | |
log.info("Found {} txs", trx.size()); | |
} | |
} | |
} | |
private List<Transaction> findAllTransactionsChainedTo(long pointer, byte[] trunkTransaction) { | |
List<Transaction> trx = new ArrayList<>(); | |
while (pointer < ofWhat???) { // how do I get the ending pointer of the tangle? | |
Transaction t = (loadTransaction(pointer)); | |
if (t.trunkTransaction.equals(trunkTransaction)) { | |
trx.add(t); | |
} | |
pointer += CELL_SIZE; | |
} | |
return trx; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment