@@ -800,29 +800,37 @@ impl Node {
800
800
let event_handling_stopped_logger = Arc :: clone ( & self . logger ) ;
801
801
let mut event_handling_stopped_receiver = self . event_handling_stopped_sender . subscribe ( ) ;
802
802
803
- let _ = runtime
804
- . block_on ( async {
805
- tokio:: time:: timeout (
806
- Duration :: from_secs ( 10 ) ,
807
- event_handling_stopped_receiver. changed ( ) ,
808
- )
809
- . await
810
- } )
811
- . map_err ( |e| {
803
+ // FIXME: For now, we wait up to 100 secs (BDK_WALLET_SYNC_TIMEOUT_SECS + 10) to allow
804
+ // event handling to exit gracefully even if it was blocked on the BDK wallet syncing. We
805
+ // should drop this considerably post upgrading to BDK 1.0.
806
+ let timeout_res = runtime. block_on ( async {
807
+ tokio:: time:: timeout (
808
+ Duration :: from_secs ( 100 ) ,
809
+ event_handling_stopped_receiver. changed ( ) ,
810
+ )
811
+ . await
812
+ } ) ;
813
+
814
+ match timeout_res {
815
+ Ok ( stop_res) => match stop_res {
816
+ Ok ( ( ) ) => { } ,
817
+ Err ( e) => {
818
+ log_error ! (
819
+ event_handling_stopped_logger,
820
+ "Stopping event handling failed. This should never happen: {}" ,
821
+ e
822
+ ) ;
823
+ panic ! ( "Stopping event handling failed. This should never happen." ) ;
824
+ } ,
825
+ } ,
826
+ Err ( e) => {
812
827
log_error ! (
813
828
event_handling_stopped_logger,
814
- "Stopping event handling timed out. This should never happen : {}" ,
829
+ "Stopping event handling timed out: {}" ,
815
830
e
816
831
) ;
817
- debug_assert ! ( false ) ;
818
- } )
819
- . unwrap_or_else ( |_| {
820
- log_error ! (
821
- event_handling_stopped_logger,
822
- "Stopping event handling failed. This should never happen." ,
823
- ) ;
824
- panic ! ( "Stopping event handling failed. This should never happen." ) ;
825
- } ) ;
832
+ } ,
833
+ }
826
834
827
835
#[ cfg( tokio_unstable) ]
828
836
{
0 commit comments