mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 23:03:04 +00:00
Clean up another listener invocation a bit.
This commit is contained in:
parent
0c3096ed74
commit
57b4774985
@ -450,8 +450,8 @@ public abstract class AbstractBlockChain {
|
|||||||
// If we do, send them to the wallet but state that they are on a side chain so it knows not to try and
|
// If we do, send them to the wallet but state that they are on a side chain so it knows not to try and
|
||||||
// spend them until they become activated.
|
// spend them until they become activated.
|
||||||
if (block.transactions != null || filteredTxn != null) {
|
if (block.transactions != null || filteredTxn != null) {
|
||||||
for (int i = 0; i < listeners.size(); i++) {
|
boolean first = true;
|
||||||
BlockChainListener listener = listeners.get(i);
|
for (BlockChainListener listener : listeners) {
|
||||||
List<Transaction> txnToNotify;
|
List<Transaction> txnToNotify;
|
||||||
if (block.transactions != null)
|
if (block.transactions != null)
|
||||||
txnToNotify = block.transactions;
|
txnToNotify = block.transactions;
|
||||||
@ -462,17 +462,13 @@ public abstract class AbstractBlockChain {
|
|||||||
// is relevant to both of them, they don't end up accidentally sharing the same object (which can
|
// is relevant to both of them, they don't end up accidentally sharing the same object (which can
|
||||||
// result in temporary in-memory corruption during re-orgs). See bug 257. We only duplicate in
|
// result in temporary in-memory corruption during re-orgs). See bug 257. We only duplicate in
|
||||||
// the case of multiple wallets to avoid an unnecessary efficiency hit in the common case.
|
// the case of multiple wallets to avoid an unnecessary efficiency hit in the common case.
|
||||||
sendTransactionsToListener(newBlock, NewBlockType.SIDE_CHAIN, listener, txnToNotify, i > 0);
|
sendTransactionsToListener(newBlock, NewBlockType.SIDE_CHAIN, listener, txnToNotify, first);
|
||||||
if (filteredTxHashList != null) {
|
if (filteredTxHashList != null) {
|
||||||
for (Sha256Hash hash : filteredTxHashList) {
|
for (Sha256Hash hash : filteredTxHashList) {
|
||||||
listener.notifyTransactionIsInBlock(hash, newBlock, NewBlockType.SIDE_CHAIN);
|
listener.notifyTransactionIsInBlock(hash, newBlock, NewBlockType.SIDE_CHAIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == listeners.size()) {
|
first = false;
|
||||||
break; // Listener removed itself and it was the last one.
|
|
||||||
} else if (listeners.get(i) != listener) {
|
|
||||||
i--; // Listener removed itself and it was not the last one.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user