-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
When LND starts up, it should handle any immediately serviceable on-chain events (breach retribution, sweeping HTLCs, etc.) prior to starting the connection manager. Once the connection manager is running, LND's attack surface widens greatly, so it is best to handle critical on-chain things beforehand.
During startup, we already wait for the wallet to sync with the blockchain before doing anything else. But we don't do the same for ChainArbitrator in server.Start(). This creates a race where it is possible for a peer to connect to our node before on-chain events have been handled.
This could be a problem if an attacker has a fast way to crash our node after connecting (e.g., ping of death). They could crash our node and broadcast a commitment tx while we're offline. Then every time our node tries to restart, the attacker may be able to crash it again before it punishes revoked commitments or sweeps HTLCs.