diff --git a/picoquic/picoquic_internal.h b/picoquic/picoquic_internal.h
index 885b222d48ab680de194680f120edb689e45f9a7..664a120e7b65240df49ca497e21f5e275b965eb4 100644
--- a/picoquic/picoquic_internal.h
+++ b/picoquic/picoquic_internal.h
@@ -755,7 +755,7 @@ void picoquic_register_path(picoquic_cnx_t* cnx, picoquic_path_t * path_x);
 void picoquic_delete_path(picoquic_cnx_t* cnx, int path_index);
 void picoquic_demote_path(picoquic_cnx_t* cnx, int path_index, uint64_t current_time);
 void picoquic_promote_path_to_default(picoquic_cnx_t* cnx, int path_index, uint64_t current_time);
-void picoquic_delete_abandoned_paths(picoquic_cnx_t* cnx, uint64_t current_time);
+void picoquic_delete_abandoned_paths(picoquic_cnx_t* cnx, uint64_t current_time, uint64_t * next_wake_time);
 
 /* Management of the CNX-ID stash */
 picoquic_cnxid_stash_t * picoquic_dequeue_cnxid_stash(picoquic_cnx_t* cnx);
diff --git a/picoquic/quicctx.c b/picoquic/quicctx.c
index b000d83e3384ca25258cbf34ea7b2dce0406755a..3bd56eb1099760b93950692fe37bf986fd12dbf2 100644
--- a/picoquic/quicctx.c
+++ b/picoquic/quicctx.c
@@ -864,7 +864,7 @@ void picoquic_delete_path(picoquic_cnx_t* cnx, int path_index)
  * Path challenges may be abandoned if they are tried too many times without success. 
  */
 
-void picoquic_delete_abandoned_paths(picoquic_cnx_t* cnx, uint64_t current_time)
+void picoquic_delete_abandoned_paths(picoquic_cnx_t* cnx, uint64_t current_time, uint64_t * next_wake_time)
 {
     int path_index_good = 1;
     int path_index_current = 1;
@@ -876,6 +876,12 @@ void picoquic_delete_abandoned_paths(picoquic_cnx_t* cnx, uint64_t current_time)
             /* Only increment the current index */
             path_index_current++;
         } else {
+            if (cnx->path[path_index_current]->path_is_demoted &&
+                current_time < cnx->path[path_index_current]->demotion_time &&
+                *next_wake_time > cnx->path[path_index_current]->demotion_time) {
+                *next_wake_time = cnx->path[path_index_current]->demotion_time;
+            }
+
             if (path_index_current > path_index_good) {
                 /* swap the path indexed good with current */
                 picoquic_path_t * path_x = cnx->path[path_index_current];
diff --git a/picoquic/sender.c b/picoquic/sender.c
index a6a73468b6787dd7ebe7fc56157ae71ab59252c3..d6e891604a7f6f2f34c5a7c707ac88e3a53f0c99 100644
--- a/picoquic/sender.c
+++ b/picoquic/sender.c
@@ -1148,52 +1148,6 @@ uint32_t picoquic_prepare_mtu_probe(picoquic_cnx_t* cnx,
     return probe_length - checksum_length;
 }
 
-static uint64_t picoquic_get_challenge_wake_time(picoquic_cnx_t* cnx, uint64_t current_time, uint64_t next_wake_time)
-{
-    picoquic_probe_t * probe = cnx->probe_first;
-
-    /* Consider demotions */
-    for (int i = 0; next_wake_time > current_time && i < cnx->nb_paths; i++) {
-        if (cnx->path[i]->path_is_demoted) {
-            if (cnx->path[i]->demotion_time < next_wake_time) {
-                next_wake_time = cnx->path[i]->demotion_time;
-            }
-        }
-        else {
-            if (cnx->path[i]->response_required) {
-                next_wake_time = current_time;
-                break;
-            }
-
-            if (cnx->path[i]->challenge_verified == 0 && cnx->path[i]->path_is_activated) {
-                uint64_t next_challenge_time = cnx->path[i]->challenge_time + cnx->path[i]->retransmit_timer;
-
-                if (next_challenge_time < next_wake_time) {
-                    next_wake_time = next_challenge_time;
-                }
-            }
-        }
-    }
-
-    /* Consider probe timers */
-    while (probe != NULL && next_wake_time > current_time) {
-        if (probe->challenge_verified == 0) {
-            uint64_t next_challenge_time = probe->challenge_time + cnx->path[0]->retransmit_timer;
-
-            if (next_challenge_time <= next_wake_time) {
-                next_wake_time = next_challenge_time;
-            }
-        }
-        probe = probe->next_probe;
-    }
-
-    if (next_wake_time < current_time) {
-        next_wake_time = current_time;
-    }
-
-    return next_wake_time;
-}
-
 /* Prepare the next packet to 0-RTT packet to send in the client initial
  * state, when 0-RTT is available
  */
@@ -2406,9 +2360,6 @@ int picoquic_prepare_packet_ready(picoquic_cnx_t* cnx, picoquic_path_t * path_x,
             picoquic_cc_dump(cnx, current_time);
         }
     }
-    else {
-        *next_wake_time = picoquic_get_challenge_wake_time(cnx, current_time, *next_wake_time);
-    }
 
     return ret;
 }
@@ -2626,7 +2577,7 @@ int picoquic_prepare_packet(picoquic_cnx_t* cnx,
     *send_length = 0;
 
     /* Remove delete paths */
-    picoquic_delete_abandoned_paths(cnx, current_time);
+    picoquic_delete_abandoned_paths(cnx, current_time, &next_wake_time);
 
     /* Remove failed probes */
     picoquic_delete_failed_probes(cnx);