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
A client can cast a masternode vote on a contested resource without blocking the main thread, as it already can for the DPNS contest reads (dpnsContestVoteStateOffMain, dpnsContestIsOpenOffMain).
Current Behavior
SDK.castContestedResourceVote(...) (packages/swift-sdk/Sources/SwiftDashSDK/FFI/PlatformQueryExtensions.swift) sits in the @MainActor extension and calls dash_sdk_contested_resource_cast_vote directly; the Rust side runs runtime.block_on(...put_vote(...)). Each broadcast therefore blocks the caller's main thread for the whole network round trip. A wallet voting with many masternodes in one run (dashwallet-ios Quick voting) freezes the UI for every vote, and cannot react to the user leaving the screen until the current broadcast returns. Wrapping the call in Task.detached does not help: the method's isolation hops back to the main actor.
Possible Solution
Add a nonisolated async castContestedResourceVoteOffMain(...) that runs the FFI call on the SDK's Platform queue (the same shape as the other …OffMain methods), keeping the key bytes alive for the duration of the call.
Alternatives Considered
None on the client side; the app cannot call the actor-isolated method off the main actor.
Additional Context
Found in review of dashpay/dashwallet-ios#1366 (username voting redesign); the wallet side waits for this API.
Activity