3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-07 06:44:16 +00:00

Add a removeEventListener method. Idea from Andreas. Resolves issue 27.

This commit is contained in:
Mike Hearn 2011-07-06 12:44:18 +00:00
parent 2e2c941919
commit 1f5922b2f4

View File

@ -338,7 +338,10 @@ public class Wallet implements Serializable {
// A -> spent by B [pending]
// \-> spent by C [chain]
Transaction doubleSpent = input.outpoint.fromTx; // == A
Transaction connected = doubleSpent.outputs.get((int)input.outpoint.index).getSpentBy().parentTransaction;
int index = (int) input.outpoint.index;
TransactionOutput output = doubleSpent.outputs.get(index);
TransactionInput spentBy = output.getSpentBy();
Transaction connected = spentBy.parentTransaction;
if (pending.containsKey(connected.getHash())) {
log.info("Saw double spend from chain override pending tx {}", connected.getHashAsString());
log.info(" <-pending ->dead");
@ -382,6 +385,14 @@ public class Wallet implements Serializable {
eventListeners.add(listener);
}
/**
* Removes the given event listener object. Returns true if the listener was removed,
* false if that listener was never added.
*/
public synchronized boolean removeEventListener(WalletEventListener listener) {
return eventListeners.remove(listener);
}
/**
* Call this when we have successfully transmitted the send tx to the network, to update the wallet.
*/