Call interfaces::Wallet::getWalletTxs asynchronous #20241

issue promag opened this issue on October 26, 2020
  1. promag commented at 12:28 AM on October 26, 2020: contributor

    This function is only used by TransactionTableModel constructor which, for big wallets, causes a delay/hang on startup. This is even noticeable in #10102.

    There's two simple changes to improve this:

    1. defer getWalletTxs to when the transactions view is opened
    2. call in a background thread to not block Qt event loop, like wallet loading

    However the following issues would still be present:

    • doesn't reduce IPC traffic
    • keeps a huge lock on cs_wallet
    • loads the whole wallet in the transaction model unnecessarily (the view only shows a subset)

    Considering the above, one way to improve is to paginate getWalletTxs.

    However, TransactionTableModel can decomposes each transaction in multiple records, so it's not possible to know beforehand the row count and also because each page of transactions results in an indeterminate number of rows.

    I have 2 different approaches to improve:

    a) manage wallet records on CWallet and expose them with interfaces::Wallet::getRecords that supports pagination b) instead of table model, make records children of a row for each txid - this would allow to reopen #12578.

    I'd love to know other's thoughts on this matter. Are the 2 simple changes 1. and 2. enough for the moment?

  2. promag added the label Feature on Oct 26, 2020
  3. fanquake added the label Brainstorming on Oct 26, 2020
  4. ryanofsky commented at 12:42 PM on October 26, 2020: contributor

    I think the simple fix is to move work off of the GUI thread so the so GUI is responsive. It seems like a much smaller problem if a few wallet operations are temporarily unavailable while a big wallet is being loaded, as long as other GUI & RPC operations for other wallets and the node are available and everything is responsive.

    Making the wallet/gui interface paginated seems useful if wallet code accessed transactions through database lookups, but much less useful if everything is in memory anyway

  5. ryanofsky commented at 12:44 PM on October 26, 2020: contributor

    Reading more closely, I guess I'm just describing the approach suggested in the issue description (not the issue title). Sounds good!

  6. promag commented at 11:57 AM on October 28, 2020: contributor

    @ryanofsky while working on this I've found

    After these, the idea is to just call getWalletTxs in a background thread and have some kind of non-blocking approach to update the Qt model - probably transaction decompose also in background thread.

  7. promag renamed this:
    Ditch interfaces::Wallet::getWalletTxs
    Call interfaces::Wallet::getWalletTxs asynchronous
    on Oct 28, 2020
  8. hebasto commented at 11:00 AM on November 2, 2020: member

    Are the 2 simple changes 1. and 2. enough for the moment?

    Yes, I think so. It will be a huge improvement.

  9. hebasto referenced this in commit 3ec033ed32 on May 26, 2021
  10. willcl-ark commented at 10:14 PM on March 7, 2023: member

    @hebasto is it worth moving this issue to the GUI repo?

  11. hebasto commented at 2:35 PM on March 8, 2023: member

    @hebasto is it worth moving this issue to the GUI repo?

    I'd keep it here as this issue's solution potentially can touch code out of the qt subdirectory.

  12. hebasto added the label Wallet on Mar 8, 2023
  13. knst referenced this in commit 33c1058ef0 on Aug 2, 2024
  14. knst referenced this in commit a1a1f0b78d on Aug 2, 2024
  15. knst referenced this in commit c6bb4f606c on Aug 3, 2024
  16. knst referenced this in commit d1019445b1 on Aug 5, 2024
  17. knst referenced this in commit 25f87b9434 on Aug 5, 2024
  18. knst referenced this in commit cbc7caf634 on Aug 7, 2024
  19. willcl-ark commented at 2:28 PM on October 21, 2025: member

    This issue hasn’t attracted much interest from other contributors in quite some time.

    Given that, it doesn’t seem important enough to keep open indefinitely. I’m going to close it for now due to lack of activity, but pull requests or renewed discussion are always welcome.

    Comment here if you think this should be re-opened.

  20. willcl-ark closed this on Oct 21, 2025


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me