connectd, gossipd, pay, bcli: use timemono when solely measuring duration for timeouts.

This is immune to things like clock changes, and has the convenient side-effect that
it will *not* be overridden when we override time for developer purposes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2025-11-13 15:42:31 +10:30
parent 806dc89cad
commit 522457a12b
13 changed files with 20 additions and 20 deletions

View File

@@ -77,7 +77,7 @@ struct bitcoin_cli {
pid_t pid;
const char **args;
const char **stdinargs;
struct timeabs start;
struct timemono start;
enum bitcoind_prio prio;
char *output;
size_t output_bytes;
@@ -260,7 +260,7 @@ static void bcli_finished(struct io_conn *conn UNUSED, struct bitcoin_cli *bcli)
int ret, status;
struct command_result *res;
enum bitcoind_prio prio = bcli->prio;
u64 msec = time_to_msec(time_between(time_now(), bcli->start));
u64 msec = time_to_msec(timemono_between(time_mono(), bcli->start));
/* If it took over 10 seconds, that's rather strange. */
if (msec > 10000)
@@ -336,7 +336,7 @@ static void next_bcli(enum bitcoind_prio prio)
}
close(in);
bcli->start = time_now();
bcli->start = time_mono();
bitcoind->num_requests[prio]++;