QML Snapshot Load #488

Open
D33r-Gee wants to merge 3 commits from alt-qml-snapshotload into qt6 AGit
D33r-Gee commented 2025-07-31 21:14:47 +00:00 (Migrated from github.com)

This is an re-opened PR based on #424 and #449. It's an alternate to #485 that uses a different /bitcoin branch instead of a patch.

UTXO Snapshot Loading

Overview

This PR enables loading UTXO snapshots both during and after the initial onboarding process.

What This PR Does

  1. Adds a basic GUI interface for loading UTXO snapshots via the Connection Settings panel
  2. Enables snapshot selection during onboarding, with loading when headers are synced
  3. Implements non-blocking snapshot loading via QT Thread
  4. Provides visual confirmation of snapshot activation
  5. Adds a snapshot progress notifications accessible via a handler

Implementation Details

Core Components Modified

  1. CPP Backend (qml/models/nodemodel.cpp)
  • Manages snapshot loading state and progress
  • Uses Qt's thread system to prevent UI blocking
  • Provides progress updates via Qt signals
  • Adds support for storing snapshot file path during onboarding
  • Implements automatic snapshot loading once headers are synced
  1. UI Components (qml/components/SnapshotLoadSettings.qml, src/qml/components/ConnectionSettings.qml)
  • File selection dialog with onboarding awareness
  • Snapshot verification status
  • Progress tracking and visualization
  • Updated visibility conditions to enable loading during onboarding
  1. Snapshot Qml Model (qml/models/snapshotqml.cpp)
  • Introduces a worker class to manage snapshot metadata

Key Design Decisions

  1. Onboarding Integration
  • Allows users to select snapshot during setup
  • Delayed loading until headers are synced
  • Proper state handling between onboarding and regular modes

Testing Instructions

  1. Build
  2. Launch Bitcoin Core QML GUI
  3. Navigate to Connection Settings
  4. Test with different snapshots:
mainnet: magnet:?xt=urn:btih:559bd78170502971e15e97d7572e4c824f033492&dn=utxo-880000.dat&tr=udp%3A%2F%2Ftracker.bitcoin.sprovoost.nl%3A6969

alternatively, you can use the following link to download the mainnet snapshot: https://bitcoin-snapshots.jaonoctus.dev/

signet: https://drive.google.com/file/d/1VJeeGQncrs4xZhh6kU5IwkyatXVM4SOm/view?usp=sharing
  1. Test onboarding flow:

    • Select a snapshot file during initial setup
    • Verify it loads automatically after headers sync
  2. Verify (see screenshots below):

    • "Snapshot Loaded" confirmation appears
    • For errors, check debug.log for [snapshot]
Ubuntu 22.04 Screenshots

Screenshot 2025-05-05 154558
Screenshot 2025-05-05 154615
qt6_loading_snapshot_dialog
Screenshot 2025-05-05 154703
Screenshot 2025-05-05 154720
Screenshot 2025-07-30 103140

Expected Behavior

  • File selection dialog works
  • Node becomes usable while background validation continues
  • When selected during onboarding, snapshot loads after headers sync
Success/failure state properly displayed Screenshot 2025-07-30 101752

feedback welcome on the approach and implementation details.

This is an re-opened PR based on #424 and #449. It's an alternate to #485 that uses a different /bitcoin [branch](https://github.com/bitcoin/bitcoin/pull/33117) instead of a patch. # UTXO Snapshot Loading ## Overview This PR enables loading UTXO snapshots both during and after the initial onboarding process. ## What This PR Does 1. Adds a basic GUI interface for loading UTXO snapshots via the Connection Settings panel 2. Enables snapshot selection during onboarding, with loading when headers are synced 3. Implements non-blocking snapshot loading via QT Thread 4. Provides visual confirmation of snapshot activation 5. Adds a snapshot progress notifications accessible via a handler ## Implementation Details ### Core Components Modified 1. **CPP Backend** (`qml/models/nodemodel.cpp`) - Manages snapshot loading state and progress - Uses Qt's thread system to prevent UI blocking - Provides progress updates via Qt signals - Adds support for storing snapshot file path during onboarding - Implements automatic snapshot loading once headers are synced 2. **UI Components** (`qml/components/SnapshotLoadSettings.qml`, `src/qml/components/ConnectionSettings.qml`) - File selection dialog with onboarding awareness - Snapshot verification status - Progress tracking and visualization - Updated visibility conditions to enable loading during onboarding 3. **Snapshot Qml Model** (qml/models/snapshotqml.cpp) - Introduces a worker class to manage snapshot metadata ### Key Design Decisions 1. **Onboarding Integration** - Allows users to select snapshot during setup - Delayed loading until headers are synced - Proper state handling between onboarding and regular modes ## Testing Instructions 1. Build 2. Launch Bitcoin Core QML GUI 3. Navigate to Connection Settings 5. Test with different snapshots: ``` mainnet: magnet:?xt=urn:btih:559bd78170502971e15e97d7572e4c824f033492&dn=utxo-880000.dat&tr=udp%3A%2F%2Ftracker.bitcoin.sprovoost.nl%3A6969 alternatively, you can use the following link to download the mainnet snapshot: https://bitcoin-snapshots.jaonoctus.dev/ signet: https://drive.google.com/file/d/1VJeeGQncrs4xZhh6kU5IwkyatXVM4SOm/view?usp=sharing ``` 7. Test onboarding flow: - Select a snapshot file during initial setup - Verify it loads automatically after headers sync 8. Verify (see screenshots below): - "Snapshot Loaded" confirmation appears - For errors, check debug.log for [snapshot] <details> <summary>Ubuntu 22.04 Screenshots</summary> ![Screenshot 2025-05-05 154558](https://git.fish.foo/attachments/1579699d-1c11-4834-abb7-c8a446985b7d) ![Screenshot 2025-05-05 154615](https://git.fish.foo/attachments/5a756189-64c9-4bb6-8bfb-c595047d2dda) ![qt6_loading_snapshot_dialog](https://git.fish.foo/attachments/457040aa-d517-4b25-a7cf-406245db1efa) ![Screenshot 2025-05-05 154703](https://git.fish.foo/attachments/c3f69f4b-9d3f-4f0d-ba80-26cdd913938c) ![Screenshot 2025-05-05 154720](https://git.fish.foo/attachments/956f1d75-687e-4086-bcf2-4dbed70f9522) <img width="646" height="705" alt="Screenshot 2025-07-30 103140" src="https://git.fish.foo/attachments/7226f20d-356a-4b95-89ee-d71d2227c4e7" /> </details> ### Expected Behavior - File selection dialog works - Node becomes usable while background validation continues - When selected during onboarding, snapshot loads after headers sync <details> <summary>Success/failure state properly displayed</summary> <img width="650" height="705" alt="Screenshot 2025-07-30 101752" src="https://git.fish.foo/attachments/b981f48a-f1ad-4117-bc10-c3129b1a0823" /> </details> feedback welcome on the approach and implementation details.
pinheadmz commented 2025-08-04 14:33:59 +00:00 (Migrated from github.com)

I don't know why CI is able to build, I am failing locally which makes sense because .gitmodules is still pointing at bitcoin core:

--> cat .gitmodules 
[submodule "bitcoin"]
	path = bitcoin
	url = https://github.com/bitcoin/bitcoin

but your commit is not part of that repo, so I get:

--> git submodule update --init
Submodule 'bitcoin' (https://github.com/bitcoin/bitcoin) registered for path 'bitcoin'
Cloning into '/Users/matthewzipkin/Desktop/work/gui-qml/bitcoin'...
fatal: transport 'file' not allowed
fatal: Fetched in submodule path 'bitcoin', but it did not contain c29a5df51402b85fb335b0d16e3016e984224d90. Direct fetching of that commit failed.

I am still trying to figure out what the "file" protocol message is about but otherwise I sort of expected to see this error in CI as well. ChatGPT suspects that the github "checkout" action may have access to some huge github-wide cache and is somehow able to look up c29a... even though it actually lives in https://github.com/D33r-Gee/bitcoin/tree/interface-load-snapshot

I don't know why CI is able to build, I am failing locally which makes sense because `.gitmodules` is still pointing at bitcoin core: ``` --> cat .gitmodules [submodule "bitcoin"] path = bitcoin url = https://github.com/bitcoin/bitcoin ``` but your commit is not part of that repo, so I get: ``` --> git submodule update --init Submodule 'bitcoin' (https://github.com/bitcoin/bitcoin) registered for path 'bitcoin' Cloning into '/Users/matthewzipkin/Desktop/work/gui-qml/bitcoin'... fatal: transport 'file' not allowed fatal: Fetched in submodule path 'bitcoin', but it did not contain c29a5df51402b85fb335b0d16e3016e984224d90. Direct fetching of that commit failed. ``` I am still trying to figure out what the "file" protocol message is about but otherwise I sort of expected to see this error in CI as well. ChatGPT suspects that the github "checkout" action may have access to some huge github-wide cache and is somehow able to look up `c29a...` even though it actually lives in https://github.com/D33r-Gee/bitcoin/tree/interface-load-snapshot
pinheadmz commented 2025-08-04 15:10:13 +00:00 (Migrated from github.com)

The fix for me locally which I think should be part of the PR is:

diff --git a/.gitmodules b/.gitmodules
index fabdfe506..03c475675 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
 [submodule "bitcoin"]
        path = bitcoin
-       url = https://github.com/bitcoin/bitcoin
+       url = https://github.com/D33r-Gee/bitcoin

Then I executed:

git submodule sync
git submodule update --init

This tells git to re-read .gitmodules so it sees the new repo, then the update command pulls that and can fetch the specified commit:

Submodule path 'bitcoin': checked out 'c29a5df51402b85fb335b0d16e3016e984224d90'

The fix for me locally which I think should be part of the PR is: ```diff diff --git a/.gitmodules b/.gitmodules index fabdfe506..03c475675 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "bitcoin"] path = bitcoin - url = https://github.com/bitcoin/bitcoin + url = https://github.com/D33r-Gee/bitcoin ``` Then I executed: ``` git submodule sync git submodule update --init ``` This tells git to re-read `.gitmodules` so it sees the new repo, then the update command pulls that and can fetch the specified commit: `Submodule path 'bitcoin': checked out 'c29a5df51402b85fb335b0d16e3016e984224d90'`
pinheadmz commented 2025-08-04 18:08:44 +00:00 (Migrated from github.com)

concept and tested ACK, no code review yet

Screenshot 2025-08-04 at 1 45 27 PM
--> bitcoin-cli -datadir=/Users/matthewzipkin/Desktop/asutxo/ gettxoutsetinfo
{
  "height": 880355,
  "bestblock": "000000000000000000027d56fb62e21d05bc0626334ece51e780bc68b5e7e1ea",
  "txouts": 184590802,
  "bogosize": 14352668388,
  "hash_serialized_3": "fd3028844649c086e0223880e3b1f8b271775a549598c22ad12792c27553c98f",
  "total_amount": 19813391.91492533,
  "transactions": 128585770,
  "disk_size": 12552553130
}
concept and tested ACK, no code review yet <img width="1426" height="970" alt="Screenshot 2025-08-04 at 1 45 27 PM" src="https://git.fish.foo/attachments/678a3bd0-dbc4-4889-8d7c-19b392234f5d" /> ``` --> bitcoin-cli -datadir=/Users/matthewzipkin/Desktop/asutxo/ gettxoutsetinfo { "height": 880355, "bestblock": "000000000000000000027d56fb62e21d05bc0626334ece51e780bc68b5e7e1ea", "txouts": 184590802, "bogosize": 14352668388, "hash_serialized_3": "fd3028844649c086e0223880e3b1f8b271775a549598c22ad12792c27553c98f", "total_amount": 19813391.91492533, "transactions": 128585770, "disk_size": 12552553130 } ```
D33r-Gee commented 2025-08-05 15:22:45 +00:00 (Migrated from github.com)

concept and tested ACK, no code review yet

Thanks for testing @pinheadmz !

As you saw currently updating the upstream portion which will impact code review here.

Ultimately, the snapshot processing (path → file & metadata) will be moved there. Once the flow is more solid in that location, I’ll update the code here accordingly by removing the models/snapshotqml files and updating the snapshot info retrieval method.

> concept and tested ACK, no code review yet Thanks for testing @pinheadmz ! As you saw currently updating the [upstream](https://github.com/bitcoin/bitcoin/pull/33117) portion which will impact code review here. Ultimately, the snapshot processing (path → file & metadata) will be moved there. Once the flow is more solid in that location, I’ll update the code here accordingly by removing the models/snapshotqml files and updating the snapshot info retrieval method.
D33r-Gee commented 2025-08-07 18:56:34 +00:00 (Migrated from github.com)

with a05e12c addresses @pinheadmz comment about pointing the submodule url to my repo

daf644c squashed the snapshot loading functionality into one commit and has been updated with new interface from upstream (bitcoin/bitcoin PR#33117)

with [a05e12c](https://github.com/bitcoin-core/gui-qml/commit/a05e12c85a25d78bb90754a4ee78b9a8bb493018) addresses @pinheadmz comment about pointing the submodule url to my repo [daf644c](https://github.com/bitcoin-core/gui-qml/commit/daf644c727e2d03471448052e104955d9dd493c7) squashed the snapshot loading functionality into one commit and has been updated with new interface from upstream (bitcoin/bitcoin PR#33117)
pinheadmz commented 2026-03-31 19:00:04 +00:00 (Migrated from github.com)

Reviewing https://github.com/bitcoin/bitcoin/pull/33117 along with this but theres a new issue building QML with bitcoin core as a subtree.

From ChatGPT:

This is a classic Qt MOC vs modern C++ (concepts) incompatibility issue.
What’s happening
The error:
usr/include/c++/12/concept:46:1: error: Parse error at "std"
comes from Qt’s moc (Meta-Object Compiler), not your compiler.
moc is trying to parse a header that includes or indirectly pulls in (C++20), which it does not fully understand.

from the compiler:

[ 88%] Automatic MOC and UIC for target bitcoinqml

AutoMoc subprocess error
------------------------
The moc process failed to compile
  "SRC:/qml/models/chainmodel.h"
into
  "SRC:/build/bitcoinqml_autogen/THJWCQWZAR/moc_chainmodel.cpp"

Command
-------
/usr/lib/qt6/libexec/moc -DBOOST_ALL_NO_LIB -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_NO_CXX98_FUNCTION_BASE -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -
DQT_NO_KEYWORDS -DQT_OPENGL_LIB -DQT_QMLINTEGRATION_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_QUICKCONTROLS2_LIB -DQT_QUICK_LIB -DQT_USE_QSTRINGBUILDER -DQT_WIDGETS_LIB -I/mnt/massive/work/gui-qml -I/mnt/massive/work/gui-qml/bitcoin/src -I/mnt/massive/work/gui-qml/bitcoin/src/qt -I/mnt/massive/work/gui-qml/build/bitcoin/src -I/mnt/massive/work/gui-qml/bitcoin/src/univalue/include -I/usr/include/x86_64-linux-gnu/qt6/QtQml -I/usr/include/x86_64-linux-gnu/qt6 -I/usr/include/x86_64-linux-gnu/qt6/QtCore -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -I/usr/include/x86_64-linux-gnu/qt6/QtQmlIntegration -I/usr/include/x86_64-linux-gnu/qt6/QtNetwork -I/usr/include/x86_64-linux-gnu/qt6/QtQuick -I/usr/include/x86_64-linux-gnu/qt6/QtGui -I/usr/include/x86_64-linux-gnu/qt6/QtQmlModels -I/usr/include/x86_64-linux-gnu/qt6/QtOpenGL -I/usr/include/x86_64-linux-gnu/qt6/QtQuickControls2 -I/usr/include/x86_64-linux-gnu/qt6/QtWidgets -I/usr/include -I/usr/include/c++/12 -I/usr/include/x86_64-linux-gnu/c++/12 -I/usr/include/c++/12/backward -I/usr/lib/gcc/x86_64-linux-gnu/12/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu --include /mnt/massive/work/gui-qml/build/bitcoinqml_autogen/moc_predefs.h -I/mnt/massive/work/gui-qml/qml --output-dep-file -o /mnt/massive/work/gui-qml/build/bitcoinqml_autogen/THJWCQWZAR/moc_chainmodel.cpp /mnt/massive/work/gui-qml/qml/models/chainmodel.h

Output
------
usr/include/c++/12/concept:46:1: error: Parse error at "std"

gmake[2]: *** [CMakeFiles/bitcoinqml_autogen.dir/build.make:71: CMakeFiles/bitcoinqml_autogen] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:491: CMakeFiles/bitcoinqml_autogen.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
Reviewing https://github.com/bitcoin/bitcoin/pull/33117 along with this but theres a new issue building QML with bitcoin core as a subtree. From ChatGPT: > This is a classic Qt MOC vs modern C++ (concepts) incompatibility issue. > What’s happening > The error: > usr/include/c++/12/concept:46:1: error: Parse error at "std" > comes from Qt’s moc (Meta-Object Compiler), not your compiler. moc is trying to parse a header that includes or indirectly pulls in <concepts> (C++20), which it does not fully understand. from the compiler: ``` [ 88%] Automatic MOC and UIC for target bitcoinqml AutoMoc subprocess error ------------------------ The moc process failed to compile "SRC:/qml/models/chainmodel.h" into "SRC:/build/bitcoinqml_autogen/THJWCQWZAR/moc_chainmodel.cpp" Command ------- /usr/lib/qt6/libexec/moc -DBOOST_ALL_NO_LIB -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_NO_CXX98_FUNCTION_BASE -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG - DQT_NO_KEYWORDS -DQT_OPENGL_LIB -DQT_QMLINTEGRATION_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_QUICKCONTROLS2_LIB -DQT_QUICK_LIB -DQT_USE_QSTRINGBUILDER -DQT_WIDGETS_LIB -I/mnt/massive/work/gui-qml -I/mnt/massive/work/gui-qml/bitcoin/src -I/mnt/massive/work/gui-qml/bitcoin/src/qt -I/mnt/massive/work/gui-qml/build/bitcoin/src -I/mnt/massive/work/gui-qml/bitcoin/src/univalue/include -I/usr/include/x86_64-linux-gnu/qt6/QtQml -I/usr/include/x86_64-linux-gnu/qt6 -I/usr/include/x86_64-linux-gnu/qt6/QtCore -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -I/usr/include/x86_64-linux-gnu/qt6/QtQmlIntegration -I/usr/include/x86_64-linux-gnu/qt6/QtNetwork -I/usr/include/x86_64-linux-gnu/qt6/QtQuick -I/usr/include/x86_64-linux-gnu/qt6/QtGui -I/usr/include/x86_64-linux-gnu/qt6/QtQmlModels -I/usr/include/x86_64-linux-gnu/qt6/QtOpenGL -I/usr/include/x86_64-linux-gnu/qt6/QtQuickControls2 -I/usr/include/x86_64-linux-gnu/qt6/QtWidgets -I/usr/include -I/usr/include/c++/12 -I/usr/include/x86_64-linux-gnu/c++/12 -I/usr/include/c++/12/backward -I/usr/lib/gcc/x86_64-linux-gnu/12/include -I/usr/local/include -I/usr/include/x86_64-linux-gnu --include /mnt/massive/work/gui-qml/build/bitcoinqml_autogen/moc_predefs.h -I/mnt/massive/work/gui-qml/qml --output-dep-file -o /mnt/massive/work/gui-qml/build/bitcoinqml_autogen/THJWCQWZAR/moc_chainmodel.cpp /mnt/massive/work/gui-qml/qml/models/chainmodel.h Output ------ usr/include/c++/12/concept:46:1: error: Parse error at "std" gmake[2]: *** [CMakeFiles/bitcoinqml_autogen.dir/build.make:71: CMakeFiles/bitcoinqml_autogen] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:491: CMakeFiles/bitcoinqml_autogen.dir/all] Error 2 gmake[1]: *** Waiting for unfinished jobs.... ```
D33r-Gee commented 2026-04-06 17:48:27 +00:00 (Migrated from github.com)

with a904558 addressed the rebasing upstream issues that @pinheadmz brought up (Thanks for that)

Also added a commit to address the discrepancies between the qt6 submodule branch and upstream.

Regarding the macos-14 CLI failure, not quite sure how to address that?

with [a904558](https://github.com/bitcoin-core/gui-qml/commit/a90455815bd0e7d6348aa4432132a3320b424b8d) addressed the rebasing upstream issues that @pinheadmz brought up (Thanks for that) Also added a commit to address the discrepancies between the qt6 submodule branch and upstream. Regarding the macos-14 CLI failure, not quite sure how to address that?
Sign in to join this conversation.
No description provided.