gui-qml icon indicating copy to clipboard operation
gui-qml copied to clipboard

[DRAFT] WIP QML Load Snapshot Signet (160,000 height)

Open D33r-Gee opened this issue 1 year ago • 22 comments

Based on #421. For evaluation purposes only!

GUI Integration for UTXO Snapshot Loading

Overview

This PR adds initial GUI support for loading a signet UTXO snapshot at height 160,000, building on Bitcoin Core's assumeutxo infrastructure.

What This PR Does

  1. Adds a basic GUI interface for loading UTXO snapshots via the Connection Settings panel
  2. Implements non-blocking snapshot loading via QT Thread
  3. Provides visual confirmation of snapshot activation
  4. Adds a snapshot progress notifications accessible via a handler

Implementation Details

Core Components Modified

  1. Node Interface (src/node/interfaces.cpp)
  • Implements snapshotLoad() based on the loadtxoutset RPC
  • Uses background QT thread for non-blocking operation
  1. QML Integration (src/qml/models/nodemodel.cpp)
  • Manages snapshot loading state and progress
  • Introduces a worker class to manage snapshot metadata
  • Uses Qt's thread system to prevent UI blocking
  • Provides progress updates via Qt signals
  1. UI Components (src/qml/components/SnapshotSettings.qml)
  • File selection dialog
  • Snapshot verification status
  • Progress tracking and visualization

Key Design Decisions

  1. Non-blocking Implementation
  • Snapshot loading runs in separate QT thread
  • UI remains responsive during load
  1. Extensibility
  • Interface designed to accommodate future assumeutxo changes
  • Error handling framework in place

Testing Instructions

  1. Build
  2. Launch Bitcoin Core QML GUI
  3. Navigate to Connection Settings
  4. Test with sample snapshot:
magnet:?xt=urn:btih:9da986cb27b3980ea7fd06b21e199b148d486880&dn=utxo-signet-160000.dat
  1. Verify (see screenshots below):
    • "Snapshot Loaded" confirmation appears
    • Block clock shows ~50% progress
    • For errors, check debug.log for [snapshot] or [loadsnapshot] messages
Ubuntu 22.04 Screenshots

Screenshot 2024-10-11 100308 Screenshot 2024-10-11 100319 Load_UTXO_Snapshots_FileDialog Screenshot 2024-11-13 144609 Screenshot 2024-11-13 144917 Screenshot 2024-11-13 145350

Expected Behavior

  • File selection dialog works
  • Success/failure state properly displayed
  • Node becomes usable while background validation continues

Future Work

  1. Error Handling
  • Add user-facing error messages
  • Implement recovery paths
  • Add snapshot validation UI once background validation has completed
  1. Integration
  • Coordinate with upstream assumeutxo changes
  • Add support for network-specific snapshots (testnet and mainnet)
  • Integrate with initial setup wizard

Notes for Reviewers

Snapshot Compatibility

  • Currently only works with signet UTXO snapshot
  • Limited to specific 160,000 height
  • Validates against chain parameters m_assumeutxo_data (the changes there can be discarded once synced since m_assumeutxo_data is already hardcoded)

This is a work in progress - feedback welcome on the approach and implementation details.

D33r-Gee avatar Oct 11 '24 17:10 D33r-Gee