Skip to content

fix: use cancellable task for scores sync#65

Merged
ovitrif merged 1 commit intomainfrom
fix/scoring-task-type
Feb 27, 2026
Merged

fix: use cancellable task for scores sync#65
ovitrif merged 1 commit intomainfrom
fix/scoring-task-type

Conversation

@ovitrif
Copy link
Collaborator

@ovitrif ovitrif commented Feb 27, 2026

Summary

  • Fix spawn_background_processor_task misuse in scoring.rs — switch to spawn_cancellable_background_task

Problem

spawn_background_processor_task is reserved for the single LDK background processor (process_events_async). The external pathfinding scores sync was incorrectly using it, which set background_processor_task to Some(...) before Node::start() reached line 617 where the actual background processor is spawned.

This caused a debug_assert! panic in debug builds:

thread 'main' panicked at lib/ldk-node/src/runtime.rs:93:9:
Expected no background processor_task

In release builds, the debug_assert is a no-op, so the background processor task handle was silently overwritten — meaning the actual LDK event processor would never be properly awaited during shutdown.

Fix

Switch to spawn_cancellable_background_task, matching the pattern used by other periodic background tasks (RGS sync, peer reconnection, broadcast queue).

Test plan

  • bitkit-cli integration tests pass in debug builds (previously panicking at runtime.rs:93)

spawn_background_processor_task is reserved for the single LDK
background processor. The external scores sync was incorrectly
using it, which caused a debug_assert panic when Node::start()
later tried to spawn the actual background processor.

Switch to spawn_cancellable_background_task which matches the
pattern used by other periodic background tasks (RGS sync, peer
reconnection, broadcast queue).
@ovitrif ovitrif merged commit 4488961 into main Feb 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant