mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-01 21:17:13 +00:00
Add a removeEventListener method. Idea from Andreas. Resolves issue 27.
This commit is contained in:
@@ -338,7 +338,10 @@ public class Wallet implements Serializable {
|
|||||||
// A -> spent by B [pending]
|
// A -> spent by B [pending]
|
||||||
// \-> spent by C [chain]
|
// \-> spent by C [chain]
|
||||||
Transaction doubleSpent = input.outpoint.fromTx; // == A
|
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())) {
|
if (pending.containsKey(connected.getHash())) {
|
||||||
log.info("Saw double spend from chain override pending tx {}", connected.getHashAsString());
|
log.info("Saw double spend from chain override pending tx {}", connected.getHashAsString());
|
||||||
log.info(" <-pending ->dead");
|
log.info(" <-pending ->dead");
|
||||||
@@ -382,6 +385,14 @@ public class Wallet implements Serializable {
|
|||||||
eventListeners.add(listener);
|
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.
|
* Call this when we have successfully transmitted the send tx to the network, to update the wallet.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user