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
{{ message }}
Repository navigation
platform-wallet: SPV stop waits without bound for a broadcast awaiting acceptance #5192
SpvRuntime::stop (packages/rs-platform-wallet/src/spv/runtime.rs) takes the client with self.client.write().await, which waits for every read guard. broadcast_transaction_and_wait holds one for its whole acceptance wait, which is the caller's timeout (the asset-lock orchestration passes 180 s). A stop during such a broadcast (network switch, wipe, manager destroy) waits for it with no bound, and every start meanwhile is refused because a stop is in progress.
Cloning the client and dropping the guard before the acceptance wait keeps the storage, and its data-dir lock, alive after stop() returns OK, so the next start or storage clear fails with DirectoryLocked.
It also lets a broadcast overlap the client stop. The transaction goes to a client whose coordinator has stopped, the wait ends Uncertain, and SpvBroadcaster reports MaybeSent for a transaction that never left; its inputs stay reserved until the reservation TTL.
Bounding the lock wait with a timeout that then falls through to the run-loop join aborts a healthy run loop, leaving a started client with no loop.
Direction
A broadcast gate: stop closes it first, so new broadcasts are rejected as never sent, then drains the in-flight ones within its budget. Decide what an in-flight acceptance wait reports when the stop budget runs out.
A data point from a desktop consumer of rs-platform-wallet, in case it helps prioritise this. It's measured on a single-peer regtest, so no peer other than the recipient can echo, and there's no InstantSend quorum.
With timeout: None (SpvBroadcaster::broadcast), the wait runs for dash-spv's own broadcast_acceptance_timeout (60 s) plus grace. A SpvRuntime stop that started during a resend's wait took 63 s to return.
In the app this showed up as a quit, and a CLI command's shutdown, taking about a minute. That's a delay rather than a correctness problem, because the stop does complete.
On our side we now abort our own detached acceptance wait before shutting the manager down. That covers only our resend task. Any other broadcast still waiting when a stop starts still holds it, so the broadcast gate described above is what would fix it in general.
🤖 Posted autonomously by Claude on behalf of pasta.
Activity
PastaPastaPasta commentedon Nov 3, 2026
A data point from a desktop consumer of
rs-platform-wallet, in case it helps prioritise this. It's measured on a single-peer regtest, so no peer other than the recipient can echo, and there's no InstantSend quorum.timeout: None(SpvBroadcaster::broadcast), the wait runs for dash-spv's ownbroadcast_acceptance_timeout(60 s) plus grace. ASpvRuntimestop that started during a resend's wait took 63 s to return.On our side we now abort our own detached acceptance wait before shutting the manager down. That covers only our resend task. Any other broadcast still waiting when a stop starts still holds it, so the broadcast gate described above is what would fix it in general.
🤖 Posted autonomously by Claude on behalf of pasta.