Skip to content

Adds non-mempool wallet balance to overview - #952

Open
polespinasa wants to merge 6 commits into
bitcoin-core:masterfrom
polespinasa:2026-07-27-wallet_nonmempool_balance
Open

Adds non-mempool wallet balance to overview#952
polespinasa wants to merge 6 commits into
bitcoin-core:masterfrom
polespinasa:2026-07-27-wallet_nonmempool_balance

Conversation

@polespinasa

@polespinasa polespinasa commented Jul 27, 2026

Copy link
Copy Markdown
Member

Just grabbing #911

Copying the motivation from AJ's description:

The wallet can contain transactions that are not accepted into the node's mempool (eg due to containing a too large OP_RETURN output, due to too low a feerate, or due to too many unconfirmed ancestors). In the event you end up in this situation, it can appear as if funds have gone missing from your wallet due to the non-mempool balance not being reported. Correct this by reporting the non-mempool balance.

See bitcoin/bitcoin#33671 for further context.

The changes look like:

imagen

How to test

To test, start with -datacarriersize=10, and run

send '{"data": "4368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73"}' null "unset" 1

from the console. "Non-mempool: " should appear in the Balances pane on the Overview window with the change from the transaction. Restarting with -datacarriersize=100000 should allow the tx to enter the mempool, and move the amount into the Available balance. (Presumably, do this on -regtest after generating 100 blocks; or perhaps signet after grabbing some funds from a faucet)

@DrahtBot

DrahtBot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK pablomartin4btc

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

polespinasa and others added 4 commits July 27, 2026 17:37
Use getBalances when testing the current balance in OverviewPage to take into account
non_mempool balances in next commits.

Co-authored-by: Anthony Towns <aj@erisian.com.au>
The assert removal is necesary for a next commit to introduce nonmempoolbalance
as that balance should always be negative thus making this assert no longer true.

Co-authored-by: Anthony Towns <aj@erisian.com.au>
The assert in formatWithPrivacy is removed because m_mine_nonmempool is always negative, making this assert
no longer true.

Co-authored-by: Anthony Towns <aj@erisian.com.au>
@polespinasa
polespinasa force-pushed the 2026-07-27-wallet_nonmempool_balance branch from fce681b to db32a1b Compare July 27, 2026 15:38
@DrahtBot

Copy link
Copy Markdown
Contributor

🚧 At least one of the CI tasks failed.
Task riscv32 bare metal, static libbitcoin_consensus: https://github.com/bitcoin-core/gui/actions/runs/30279603397/job/90022318535
LLM reason (✨ experimental): CI failed because the Docker build’s submodule clone of newlib-cygwin.git from sourceware.org was rate-limited (HTTP 429), causing the 01_base_install.sh step to exit with code 2.

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

@polespinasa

Copy link
Copy Markdown
Member Author

Key differences with #911 are:

  • Changed the font color
  • Removed the padding after "-"
  • Separated some of the changes in multiple commits
  • Changed a bit the hint box and the naming of non-mempool balance

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

I've suggested some release notes in previous attempt #911 and it'd be nice to include them here if you're up to ofc.

Suggested Qt test snippet for wallettests.cpp...

The PR touches wallettests.cpp but only to fix the existing call — worth adding a UI-level test for the new label visibility and formatting. Since there are no actual non-mempool transactions in the test wallet, calling setBalance() directly with crafted data is the right approach here rather than going through pollBalanceChanged().

// Test non-mempool balance display
interfaces::WalletBalances nonmempool_balances;
nonmempool_balances.balance = walletModel.wallet().getBalances().balance;
nonmempool_balances.nonmempool_balance = -50000;
overviewPage.setBalance(nonmempool_balances);
QVERIFY(overviewPage.findChild<QLabel*>("labelNonMempool")->isVisible());
QVERIFY(overviewPage.findChild<QLabel*>("labelNonMempoolText")->isVisible());
CompareBalance(walletModel, -50000, overviewPage.findChild<QLabel*>("labelNonMempool"));

nonmempool_balances.nonmempool_balance = 0;
overviewPage.setBalance(nonmempool_balances);
QVERIFY(!overviewPage.findChild<QLabel*>("labelNonMempool")->isVisible());
QVERIFY(!overviewPage.findChild<QLabel*>("labelNonMempoolText")->isVisible());

Co-authored-by: Pablo Martin <pablomartin4btc@gmail.com>
@polespinasa

Copy link
Copy Markdown
Member Author

Added the tests with you as a co-author and added some release notes.
For some reason I forgot to add the release notes before.

@polespinasa
polespinasa force-pushed the 2026-07-27-wallet_nonmempool_balance branch from eee7f87 to 1907923 Compare July 27, 2026 17:57

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 1907923

@hebasto

hebasto commented Jul 29, 2026

Copy link
Copy Markdown
Member

@GBKS

Could you please weigh in on the UI/UX design choices in this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants