11use crate :: {
2- error:: { self , PoolError , PoolErrorKind } ,
3- status:: { handle_error , State , Status , StatusSender } ,
2+ error:: PoolErrorKind ,
3+ status:: { State , Status } ,
44} ;
55use async_channel:: { Receiver , Sender } ;
66use bitcoin_core_sv2:: template_distribution_protocol:: { BitcoinCoreSv2TDP , CancellationToken } ;
@@ -25,7 +25,6 @@ pub async fn connect_to_bitcoin_core(
2525 status_sender : Sender < Status > ,
2626) -> JoinHandle < ( ) > {
2727 let bitcoin_core_canc_token = bitcoin_core_config. cancellation_token . clone ( ) ;
28- let status_sender_clone = status_sender. clone ( ) ;
2928
3029 // spawn a task to handle shutdown signals and cancellation token activations
3130 task_manager. spawn ( async move {
@@ -34,20 +33,11 @@ pub async fn connect_to_bitcoin_core(
3433 bitcoin_core_canc_token. cancel( ) ;
3534 }
3635 _ = bitcoin_core_canc_token. cancelled( ) => {
37- // turn status_sender into a StatusSender::TemplateReceiver
38- let status_sender = StatusSender :: TemplateReceiver ( status_sender_clone) ;
39-
40- handle_error:: <error:: TemplateProvider >(
41- & status_sender,
42- PoolError :: shutdown( PoolErrorKind :: BitcoinCoreSv2TDPCancellationTokenActivated ) ,
43- )
44- . await ;
36+ cancellation_token. cancel( ) ;
4537 }
4638 }
4739 } ) ;
4840
49- let status_sender_clone = status_sender. clone ( ) ;
50-
5141 // spawn a dedicated thread to run the BitcoinCoreSv2TDP instance
5242 // because we're limited to tokio::task::LocalSet due to the use of `capnp` clients on
5343 // `bitcoin-core-sv2`, which are not `Send`
@@ -59,7 +49,7 @@ pub async fn connect_to_bitcoin_core(
5949 tracing:: error!( "Failed to create Tokio runtime: {:?}" , e) ;
6050
6151 // we can't use handle_error here because we're not in a async context yet
62- let _ = status_sender_clone . send_blocking ( Status {
52+ let _ = status_sender . send_blocking ( Status {
6353 state : State :: TemplateReceiverShutdown (
6454 PoolErrorKind :: FailedToCreateBitcoinCoreTokioRuntime ,
6555 ) ,
0 commit comments