Skip to content

Commit 8219d71

Browse files
authored
Merge pull request #986 from jkczyz/2026-07-scores-sync-task-collision
Fix task-slot collision when pathfinding scores sync is enabled
2 parents 056447c + cc048f3 commit 8219d71

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/scoring.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn setup_background_pathfinding_scores_sync(
2626

2727
let logger = Arc::clone(&logger);
2828

29-
runtime.spawn_background_processor_task(async move {
29+
runtime.spawn_cancellable_background_task(async move {
3030
let mut interval = tokio::time::interval(EXTERNAL_PATHFINDING_SCORES_SYNC_INTERVAL);
3131
loop {
3232
tokio::select! {

tests/integration_tests_rust.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,26 @@ async fn start_stop_reinit() {
676676
reinitialized_node.stop().unwrap();
677677
}
678678

679+
// The scores-sync task runs alongside LDK's background processor, which claims the runtime's
680+
// single background-processor slot; startup must not panic with both configured.
681+
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
682+
async fn start_stop_with_pathfinding_scores_sync() {
683+
let (_bitcoind, electrsd) = setup_bitcoind_and_electrsd();
684+
let config = random_config();
685+
686+
let esplora_url = format!("http://{}", electrsd.esplora_url.as_ref().unwrap());
687+
688+
let mut sync_config = EsploraSyncConfig::default();
689+
sync_config.background_sync_config = None;
690+
setup_builder!(builder, config.node_config);
691+
builder.set_chain_source_esplora(esplora_url.clone(), Some(sync_config));
692+
builder.set_pathfinding_scores_source(esplora_url);
693+
694+
let node = builder.build(config.node_entropy.into()).unwrap();
695+
node.start().unwrap();
696+
node.stop().unwrap();
697+
}
698+
679699
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
680700
async fn onchain_send_receive() {
681701
let (bitcoind, electrsd) = setup_bitcoind_and_electrsd();

0 commit comments

Comments
 (0)