Files
bitcoin/src/interfaces
Ava Chow cd7865b0ce Merge bitcoin/bitcoin#33671: wallet: Add separate balance info for non-mempool wallet txs
32325d1777 tests: Add test for mempool-invalid wallet tx (Anthony Towns)
25e063d950 wallet: Add separate balance info for non-mempool wallet txs (Anthony Towns)
81e763f1e5 wallet: Have GetBalance report used amount directly without two calls (Anthony Towns)

Pull request description:

  Changes `getbalances` to report the sum of txos spent by transactions that aren't confirmed nor in the mempool (eg due to being part of too long a mempool chain, or spending non-standard outputs, or having a datacarrier output that exceeds `-datacarriersize`, etc). Those values are added to the trusted/untrusted_pending/immature/used fields as appropriate (where previously they were skipped), and subtracted from the new nonmempool field, so that the sum of all fields remains the same.

  For example:

  ```
  $ bitcoin-cli -regtest getbalances
  {
    "mine": {
      "trusted": 6049.99999220,
      "untrusted_pending": 0.00000000,
      "immature": 3200.00000780,
      "nonmempool": -100.00000000
    },
    "lastprocessedblock": {
      "hash": "3ab4582226d5e8ad76438db48d76e822c31bce2cdbc7ba82a5d974a277515d0d",
      "height": 221
    }
  }
  ```

  Closes #11887

ACKs for top commit:
  achow101:
    ACK 32325d1777
  w0xlt:
    lgtm ACK 32325d1777
  musaHaruna:
    Code Review ACK [32325d1](32325d1777)

Tree-SHA512: 142581944d1b3213067e219e3b8205f27b89007e545149c01b801bad38fe730c5b2bfdfe6a2064c3649889f66ec48ec7616982564d00e3d83837249e925d8f16
2026-04-22 16:19:55 -07:00
..

Internal c++ interfaces

The following interfaces are defined here:

  • Chain — used by wallet to access blockchain and mempool state. Added in #14437, #14711, #15288, and #10973.

  • ChainClient — used by node to start & stop Chain clients. Added in #14437.

  • Node — used by GUI to start & stop bitcoin node. Added in #10244.

  • Wallet — used by GUI to access wallets. Added in #10244.

  • Handler — returned by handleEvent methods on interfaces above and used to manage lifetimes of event handlers.

  • Init — used by multiprocess code to access interfaces above on startup. Added in #19160.

  • Ipc — used by multiprocess code to access Init interface across processes. Added in #19160.

  • Rpc — used by bitcoin-cli to be able to call RPC methods over a unix socket instead of TCP.

The interfaces above define boundaries between major components of bitcoin code (node, wallet, and gui), making it possible for them to run in different processes, and be tested, developed, and understood independently. These interfaces are not currently designed to be stable or to be used externally.