- All Known Implementing Classes:
public interface TransactionConfidenceEventListenerImplementors are called when confidence of a transaction changes.
void onTransactionConfidenceChanged(Wallet wallet, Transaction tx)Called when a transaction changes its confidence level. You can also attach event listeners to the individual transactions, if you don't care about all of them. Usually you would save the wallet to disk after receiving this callback unless you already set up autosaving.
You should pay attention to this callback in case a transaction becomes dead, that is, a transaction you believed to be active (send or receive) becomes overridden by the network. This can happen if:
- You are sharing keys between wallets and accidentally create/broadcast a double spend.
- Somebody is attacking the network and reversing transactions, ie, the user is a victim of fraud.
- A bug: for example you create a transaction, broadcast it but fail to commit it. The
Walletwill then re-use the same outputs when creating the next spend.
tx.getConfidence().getConfidenceType() == TransactionConfidence.ConfidenceType.DEAD
Note that this callback will be invoked for every transaction in the wallet, for every new block that is received (because the depth has changed). If you want to update a UI view from the contents of the wallet it is more efficient to use onWalletChanged instead.