-
Notifications
You must be signed in to change notification settings - Fork 912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cleanup: Use the -rpcwait
when waiting for bitcoind to warm up
#3505
Comments
@cdecker ,Is there some community where I can discuss about the doubts I have on the code of this repository ? I would like to contribute to the lightning network community. I have started reading the book |
@gerceboss you can join discord, there is the link on the Readme |
Open bounty on this: |
Hey @cdecker,
I tried looking at other implementations of timers but couldn’t understand if they could solve the issue. My understanding is that we should only print the message after x seconds if bitcoind hasn’t started serving RPC calls. Could you please point me to some code examples or references for implementing a timer? EDIT: static void log_warm_up(struct plugin *p)
{
plugin_log(p, LOG_UNUSUAL, "Waiting for bitcoind to warm up...");
}
struct timers *timer = tal(cmd, struct timers);
timers_init(timer, time_mono());
new_reltimer(timer, timer, time_from_sec(30), log_warm_up, p); From my understanding, the Will this serve the purpose of a timer to print the warm-up message only if |
As far as I remember my concern was that unlike our polling, using the rpcwait option does not allow us to enforce a deadline of 60s, i.e., it just waits indefinitely. In LN we need to have access to the Bitcoin backend and the rpcwait option just waiting silently indefinitely is bad. We exit loudly (some refer to it as crash, but we make noise so operators are notified) if we can't talk to the Bitcoin backend. A warning logged and then a call to |
We currently use a rather lengthy loop to wait for
bitcoind
to warm up and be ready to serve RPC calls:lightning/plugins/bcli.c
Lines 710 to 749 in 44d408c
This could be simplified if we just call
bitcoin-cli
with-rpcwait
which implements the wait logic internally and allows us to skip checking the returned error (if we get an error it's not the warmup error so we can pass any error up regardless). The downside is that it doesn't allow us to print the warmup ourselves, but we could easily replace that with a single one-shot timer printing the message.The text was updated successfully, but these errors were encountered: