plugins/bcli: use -rpcwait to simplify waiting for bitcoind to warm up#7967
Conversation
rustyrussell
left a comment
There was a problem hiding this comment.
Great idea! 🧡 The timeout needs work though...
plugins/bcli.c
Outdated
| tal_free(output); | ||
| struct timers *timer = tal(cmd, struct timers); | ||
| timers_init(timer, time_mono()); | ||
| new_reltimer(timer, timer, time_from_sec(BITCOIND_WARMUP_TIMER), |
There was a problem hiding this comment.
This won't work, unfortunately. We'll be stuck in the waitpid call, not in the ioloop.
But the correct way to do this is to also use rpcwaittimeout, so it will fail, and we can log a message and retry.
There was a problem hiding this comment.
(note: rpcwait was supported since bitcoin 0.9, and rpcwaittimeout since 22.0, so we're good here)
There was a problem hiding this comment.
Just for my understanding, does the timer run synchronously with the event loop, blocking the program until it expires? Or does it run in the background (in a non-blocking manner), calling the function asynchronously, if timer expires or get cleaned up by tal_free?
There was a problem hiding this comment.
The core event loop (io_loop) exits when a timer goes off; normally the timer is then called, and the io_loop() reentered.
93b0e02 to
1d07cee
Compare
|
Hey @rustyrussell, just checking in to see if there’s any further feedback on this PR? |
|
Hi @rustyrussell, I wanted to kindly follow up on this PR to check if there’s anything else I should address or any additional feedback you're waiting on. Please let me know if I can assist in moving this forward. Thank you! |
rustyrussell
left a comment
There was a problem hiding this comment.
Thanks, and sorry for the delay!
Replaced custom wait logic with the -rpcwait flag in bitcoin-cli to handle waiting for bitcoind to warm up. This simplifies the code and ensures that errors unrelated to warmup are passed up directly without additional checks. Changelog-None Signed-off-by: Nishant Bansal <[email protected]>
1d07cee to
f8597dc
Compare
Replaced custom wait logic with the
-rpcwaitflag in bitcoin-cli to handle waiting for bitcoind to warm up. Added a timer to print the warm-up message only if bitcoind doesn't start serving RPC calls within30 seconds.This simplifies the code and ensures that errors unrelated to warmup are passed up directly without additional checks.
Fixes: #3505
Checklist
Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked: