Package org.bitcoinj.wallet.listeners
Interface WalletCoinsReceivedEventListener
- All Known Implementing Classes:
NativeWalletCoinsReceivedEventListener
public interface WalletCoinsReceivedEventListener
Implementors are called when the contents of the wallet changes, for instance due to receiving/sending money or a block chain re-organize.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onCoinsReceived
(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) This is called when a transaction is seen that sends coins to this wallet, either because it was broadcast across the network or because a block was received.
-
Method Details
-
onCoinsReceived
This is called when a transaction is seen that sends coins to this wallet, either because it was broadcast across the network or because a block was received. If a transaction is seen when it was broadcast, onCoinsReceived won't be called again when a block containing it is received. If you want to know when such a transaction receives its first confirmation, register aTransactionConfidence
event listener using the object retrieved viaTransaction.getConfidence()
. It's safe to modify the wallet in this callback, for example, by spending the transaction just received.- Parameters:
wallet
- The wallet object that received the coinstx
- The transaction which sent us the coins.prevBalance
- Balance before the coins were received.newBalance
- Current balance of the wallet. This is the 'estimated' balance.
-