I work with a Wallet app and using the BitcoinJ
for programming. I need to find the last executed transaction from the wallet. In the org.bitcoinj.core.Wallet
class, I see there is a method getTransactionsByTime()
that returns list of all non-dead, active transactions ordered by recency as List<Transaction>
.
Will I access the most recent transaction with index 0 or the last index? I have made some experiments and I likely think that would be with index of 0
. Because, it returns the sending info and I have done some recently, but, still weird as the amount doesn't match with performed.
While I have tried with the last index, I think that's obviously not the case as that's returns the info of the incoming transactions.
The way I find the most recent transaction,
transactions.addAll(wallet.getTransactionsByTime());
Transaction ts = size > 0 ? getTransactions().get(0) : null;
this.transaction = addTransactionHistory(ts);
I print the transaction
as the most recent one in console.