You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
trustedcoin: lightningd aborts with "bitcoind has gone backwards" when clightning starts right after bitcoind, and the unit then waits 10 minutes before systemd retries #192
The trustedcoin VM scenario is flaky on master, and the reason also matters on a real node.
When clightning starts while bitcoind has just come up, trustedcoin answers lightningd's first getchaininfo before its own bitcoind check has finished. In the VM there is no WAN, so the block explorer fallback returns height 0, and lightningd aborts:
plugin-trustedcoin initialized plugin 0.8.6
plugin-trustedcoin bitcoind RPC settings: {user: public, ...}
plugin-trustedcoin tip: 0
plugin-trustedcoin bitcoind RPC working, will use that with highest priority and fall back to block explorers if it fails.
lightningd: bitcoind has gone backwards from 70 to 0 blocks!
clightning.service: Main process exited, code=exited, status=1/FAILURE
The three plugin lines are a millisecond apart. tip: 0 comes out before bitcoind RPC working, so the answer came from the explorers, not from bitcoind.
After that, clightning.service sits in TimeoutStartSec = 10m because postStart waits for a socket that never appears, systemd kills it and retries after RestartSec. On master (963bff8) the retry happened to work and the scenario passed after 692 seconds. On a branch with an unrelated one-line change to the plugin's log output it failed twice in a row, on the retry as well, and the test timed out at 900 seconds. Logs from both are on my KVM host.
On a real node the explorers normally return the right tip, so this stays hidden until they don't: Tor is down, clearnet is blocked by tor.enforce, or the explorers rate-limit the node. Then a plain systemctl restart clightning can turn into a 10 minute outage, or a loop.
Two things to do:
Upstream: trustedcoin should finish the bitcoind check before it answers getchaininfo, or refuse to answer when every source failed instead of returning height 0. I'll raise it there.
Here: until that lands, the test runner could at least stop treating a 10 minute postStart hang as the only signal. A Restart=on-failure with the current TimeoutStartSec means every abort costs 10 minutes before systemd tries again.
Found while running the scenario for the trustedcoin log patch. Checked with Fable 5.1 against the VM logs of master and the branch.
Root cause and fix are upstream in nbd-wtf/trustedcoin#44. The plugin library answers init and then runs OnInit in its own goroutine, so getchaininfo can run before the bitcoind client exists. On regtest there are no explorers to fall back to, so getTip returned 0 with no error. The upstream change makes the handlers wait for init, never reports height 0 without a source, and retries a configured bitcoind for about 30 seconds. Once it lands we can bump the package here.
Activity
ostermayer commentedon Oct 31, 2026
Root cause and fix are upstream in nbd-wtf/trustedcoin#44. The plugin library answers init and then runs OnInit in its own goroutine, so getchaininfo can run before the bitcoind client exists. On regtest there are no explorers to fall back to, so getTip returned 0 with no error. The upstream change makes the handlers wait for init, never reports height 0 without a source, and retries a configured bitcoind for about 30 seconds. Once it lands we can bump the package here.
prusnak commentedon Oct 31, 2026
closed in favor of nbd-wtf/trustedcoin#44