You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: migrate received_filter_heights to tokio::Mutex and add find_available_header_at_or_before helper (#141)
* refactor: streamline header retrieval in FilterSyncManager
- Introduced `find_available_header_at_or_before` method to encapsulate the logic for scanning backward to find the nearest available block header in storage.
- Replaced repetitive header scanning logic in multiple locations with calls to the new method, improving code clarity and maintainability.
- Enhanced error handling and logging during header retrieval to provide better insights into the syncing process.
* refactor: migrate Mutex to tokio::sync::Mutex for async compatibility
- Updated `received_filter_heights` and `processing_thread_requests` to use `tokio::sync::Mutex` instead of `std::sync::Mutex` for better async support.
- Adjusted related locking mechanisms in `FilterSyncManager`, `SpvStats`, and various test files to accommodate the new async locking.
- Enhanced test files to reflect the changes in synchronization primitives, ensuring compatibility with async operations.
* refactor: optimize sync progress calculation in StatusDisplay
- Improved the sync progress method by cloning the inner heights handle and copying necessary counters without holding the RwLock, enhancing performance.
- Updated the calculation of the last synced filter height to avoid holding the RwLock guard, ensuring better concurrency and responsiveness in the status display.
* refactor: introduce SharedFilterHeights type for improved readability
- Created a new type alias `SharedFilterHeights` for the mutex-protected set of filter heights, enhancing code clarity and reducing redundancy.
- Updated references in `SpvStats`, `FilterSyncManager`, and `SequentialSyncManager` to use the new type alias, streamlining the codebase.
* fix: improve error handling in filter header sync
- Updated the error handling in the filter header synchronization process to return a more informative `SyncError` when no available headers are found between specified heights.
- This change enhances the clarity of error reporting, aiding in debugging and improving the overall robustness of the synchronization logic.
* refactor: update processing_thread_requests to use tokio::sync::Mutex
- Changed the locking mechanism for `processing_thread_requests` from `std::sync::Mutex` to `tokio::sync::Mutex` to enhance async compatibility.
- Updated the locking logic in the `spawn_filter_processor` and related methods to use async await syntax, improving performance and responsiveness in the filter processing workflow.
* refactor: improve filter sync locking mechanism
- Updated the locking logic in the filter synchronization process to clone the `received_filter_heights` before awaiting the mutex, ensuring the `RwLock` is released promptly.
- This change enhances concurrency and responsiveness during filter sync operations, aligning with recent async improvements in the codebase.
0 commit comments