-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Background
We run two LND nodes in kubernetes, and after restarting the backing Bitcoin Core node, we notice that LND falls out of sync with the blockchain.
This happens because, in our kubernetes environment, the IP address of Bitcoin Core changes when it is restarted. synced_to_chain
will become false
and no new blocks will be received.
Your environment
- version of
lnd
: v0.18.2-beta - which operating system (
uname -a
on *Nix):
Linux lnd-routing-0 6.8.0-1018-aws #19~22.04.1-Ubuntu SMP Wed Oct 9 17:10:38 UTC 2024 aarch64 Linux
andLinux 9db991b293cb 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64 Linux
- version of
btcd
,bitcoind
, or other backend: Bitcon Core 27.0 - any other relevant environment details: We run our stack in kubernetes
Steps to reproduce
I'll show how I reproduce it in regtest, but we get the same issue in production (running in kubernetes) too.
- We run LND with the following config in docker-compose:
--listen=0.0.0.0:9735
--externalip=lnd-0
--rpclisten=0.0.0.0:10009
--bitcoin.active
--bitcoin.node=bitcoind
--bitcoin.regtest
--bitcoind.rpcuser=test
--bitcoind.rpcpass=password
--bitcoind.rpchost=bitcoin:18443
--bitcoind.zmqpubrawblock=tcp://bitcoin:18501
--bitcoind.zmqpubrawtx=tcp://bitcoin:18502
--norest
--protocol.wumbo-channels
When running this, bitcoin
resolves to 172.18.0.2
.
- Build some blocks and make sure LND is in sync by running
lncli -network=regtest getinfo
and check thatsynced_to_chain
istrue
. - Stop bitcoin core, and restart it again, but this time make sure it gets a new IP address, so from now on
bitcoin
resolves to e.g.172.18.0.6
. - Build a block
- Run
lncli -network=regtest getinfo
.synced_to_chain
will befalse
, butblock_height
andblock_hash
will be the most recent one.
After this, LND will not receive any new blocks, but it has apparently reconnected (presumably through RPC) to get the latest block hash. My guess is that ZMQ stops working due to the IP address change.
Expected behaviour
After reconnecting to the node it should eventually show "synced_to_chain": true
. Alternatively (it it's a ZMQ connection issue) I'd expect LND to scream pretty loudly in the log.
Actual behaviour
"synced_to_chain": false
indefinitely and we see no new logs of type
[INF] NTFN: New block: height=873198, sha=000000000000000000007b48042479e4f07ce2d6ae9a79c2a3ef5223dc78dd5c