Hi,

Please check below code:

            kit.wallet().addCoinsReceivedEventListener(new 
WalletCoinsReceivedEventListener() {
              @Override
              public void onCoinsReceived(Wallet w, final Transaction tx, 
Coin prevBalance, Coin newBalance) {
                  
                  Futures.addCallback(tx.getConfidence().getDepthFuture(*6*), 
new FutureCallback<TransactionConfidence>() {
                      @Override
                      public void onSuccess(TransactionConfidence result) 
                      {
                          //Updated tx status to confirm when depth become 
6 block
                      }

                      @Override
                      public void onFailure(Throwable t) {
                          // This kind of future can't fail, just rethrow 
in case something weird happens.
                          //throw new RuntimeException(t);
                      }
                  });
                  
              }
          });

On Thursday, 18 January 2018 00:06:43 UTC+5:30, v e wrote:
>
> Hi,
>
> I am new to bitcoinJ library and looking to notify some listener when i 
> get a particular transaction confirmed.Here is my code so far
>
> receiverW.wallet.addCoinsReceivedEventListener(new 
> WalletCoinsReceivedEventListener() {
>     public void onCoinsReceived(Wallet wallet, Transaction tx, Coin coin, 
> Coin coin1) {
>         tx.getConfidence();
>         System.out.println("-----> coins resceived: " + tx.getHashAsString());
>         System.out.println("received: " + tx.getValue(wallet));
>     }
> });
>
> However, when i ran the code, the above method got invoked when the 
> transaction is placed in the block but not when it is confirmed.
>
>
> What logic do i need to add for confirmation of the transaction?
>
>
> thanks
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to