Skip to content

android: no received transaction notification when tx confirms without being seen in mempool #797

@piotr-iohk

Description

@piotr-iohk

What happened?

When an on-chain transaction is sent to the wallet and a block is mined before the next LDK sync picks up the unconfirmed tx, the "received transaction" sheet/notification does not appear. The balance updates correctly and the activity list shows the transaction, but the user gets no visual feedback that funds arrived.

This happens because LDK Node only fires OnchainTransactionConfirmed (skipping OnchainTransactionReceived) when the tx goes straight to confirmed. The notification is only wired to OnchainTransactionReceived in AppViewModel.handleOnchainTransactionReceived(), while handleOnchainTransactionConfirmed() only updates the activity — it never checks whether the user was already notified.

Expected behavior

The "received transaction" sheet should appear whenever a new incoming on-chain transaction is detected, regardless of whether it was first seen in the mempool or directly as confirmed.

Steps to Reproduce

  1. Create a new wallet on regtest
  2. Copy the wallet's on-chain address
  3. Send BTC to that address from an external wallet (e.g. via bitcoin-cli)
  4. Immediately mine a block (before the app's next sync cycle)
  5. Observe: balance updates, activity list shows the tx, but no "received" notification/sheet appears

Logs / Screenshots / Recordings

Android log confirms zero OnchainTransactionReceived events. The tx appears only as OnchainTransactionConfirmed:

12:28:33.796 LDK event fired: {"type":"OnchainTransactionConfirmed","txid":"bedcc68c...","blockHeight":69235,...}
12:28:33.879 AppViewModel: LDK-node event received: OnchainTransactionConfirmed
12:28:33.954 LDK event fired: {"type":"BalanceChanged","oldSpendableOnchainBalanceSats":0,"newSpendableOnchainBalanceSats":100000000,...}

No OnchainTransactionReceived event appears anywhere in the log session.

2026-02-20-missing-received-notification-logs.zip

Bitkit Version

master (98fd89c)

Device / OS

Android Emulator, API 35

Reproducibility

Always

Additional context

  • New wallet on regtest
  • On-chain related
  • Environment: Regtest (network electrum)
  • On mainnet this is very unlikely because the ~10 min block interval gives periodic sync time to see the unconfirmed tx first, but it's theoretically possible if the app is backgrounded/offline during the brief window between broadcast and confirmation
  • The same issue exists on iOS (filed separately)
  • Relevant code: AppViewModel.kt lines ~501-512 — handleOnchainTransactionConfirmed only updates activity, while handleOnchainTransactionReceived (lines ~510-512) triggers notifyPaymentReceived()
  • Fix: handleOnchainTransactionConfirmed should also check whether the tx was already notified and, if not, trigger the same notification flow
  • same as: ios: no received transaction notification when tx confirms without being seen in mempool bitkit-ios#455

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions