Fix Nostr relay race conditions blocking project scan/recovery#900
Merged
Conversation
- Use unique subscription name per LookupProjectsInfoByEventIds call instead of hardcoded 'ProjectInfoLookups' to prevent EOSE action collisions when GetAllAsync is called multiple times - Complete ProjectInfos/ProjectMetadatas early once all requested data is received, instead of waiting for EOSE from all relays. A single slow/unresponsive relay was blocking the entire flow. - Log scan failures in ScanFounderProjects instead of silently swallowing them, and propagate the error when no local projects exist - Surface scan errors to the user via toast, and fix the toast invocation to run on the UI thread instead of inside Task.Run
Show a spinning 'Claiming Funds...' modal overlay while the SDK builds and broadcasts the claim transaction. Previously the claim modal would dismiss and the user saw a blank screen for ~1s before the success popup. - Add IsClaiming-bound spinner overlay between fee selection and success - Set IsClaiming=true before hiding claim modal to prevent frame gap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Old projects (and intermittently new ones) fail to appear in My Projects after wallet recovery/scan. The project is found on-chain by the indexer, but the Nostr relay lookup silently fails, and no error is shown to the user.
Root Causes
Subscription name collision -
LookupProjectsInfoByEventIdsused a hardcoded subscription name"ProjectInfoLookups". WhenScanFounderProjectscallsGetAllAsynctwice (discovery + reload), the second call's EOSE action fails to register viaTryAddbecause the first call's cleanup hasn't completed. TheTaskCompletionSourcethen only resolves via timeout, often with empty results.All-relays EOSE requirement -
ProjectInfosandProjectMetadataswait for EOSE from every connected relay before completing. If even one relay is slow or doesn't have the data, the entire flow blocks until timeout (10s/30s), even though the needed data already arrived from other relays.Silent error swallowing -
ScanFounderProjectssilently discardedGetAllAsyncfailures with no logging. The UI showed no error, making the issue invisible.Toast on wrong thread -
ToastRequested?.Invoke()was called insideTask.Run, causing an exception that was caught by the generic catch block, replacing the real error with "Failed to scan for projects".Fixes
LookupProjectsInfoByEventIdsnow usesGuid.NewGuid()per call, matching the pattern used by every other method inRelayServiceProjectInfosandProjectMetadatascomplete as soon as all requested data is received (deduplicated across relays), without waiting for remaining relays to EOSEScanFounderProjectslogs scan failures and propagates the error when no local projects existFiles Changed
src/shared/Angor.Shared/Services/RelayService.cs- Unique subscription namesrc/sdk/Angor.Sdk/Funding/Services/DocumentProjectService.cs- Early completion in ProjectInfos/ProjectMetadatassrc/sdk/Angor.Sdk/Funding/Founder/Operations/ScanFounderProjects.cs- Error logging + propagationsrc/design/App/UI/Sections/MyProjects/MyProjectsViewModel.cs- Toast fixsrc/sdk/Angor.Sdk.Tests/Funding/Founder/ScanFounderProjectsTests.cs- Updated for new constructor