Open
Description
Background
maxbackoff is not respected by connections managed by btcd's connection manager. If you set maxbackoff=1s in the config, the initial schedule attempt will take into account the maxbackoff, but the reconnect requests will not. Example logs:
2024-11-21 13:20:59.373 [DBG] SRVR: Scheduling connection re-establishment to persistent peer 02fb6f53b5f7363e937bc86b1c99afebdcd52e239b6a632cca37caedad4866d850 in 1s
2024-11-21 13:21:00.374 [DBG] SRVR: Attempting to re-establish persistent connection to peer 02fb6f53b5f7363e937bc86b1c99afebdcd52e239b6a632cca37caedad4866d850
2024-11-21 13:21:00.374 [DBG] SRVR: Attempting persistent connection to channel peer 02fb6f53b5f7363e937bc86b1c99afebdcd52e239b6a632cca37caedad4866d850@127.0.0.1:35947
2024-11-21 13:21:00.374 [DBG] CMGR: Attempting to connect to 02fb6f53b5f7363e937bc86b1c99afebdcd52e239b6a632cca37caedad4866d850@127.0.0.1:35947 (reqid 1)
2024-11-21 13:21:00.375 [DBG] CMGR: Failed to connect to 02fb6f53b5f7363e937bc86b1c99afebdcd52e239b6a632cca37caedad4866d850@127.0.0.1:35947 (reqid 1): dial tcp 127.0.0.1:35947: connect: connection refused
2024-11-21 13:21:00.375 [DBG] CMGR: Retrying connection to 02fb6f53b5f7363e937bc86b1c99afebdcd52e239b6a632cca37caedad4866d850@127.0.0.1:35947 (reqid 1) in 5s
2024-11-21 13:21:05.375 [DBG] CMGR: Attempting to connect to 02fb6f53b5f7363e937bc86b1c99afebdcd52e239b6a632cca37caedad4866d850@127.0.0.1:35947 (reqid 1)
2024-11-21 13:21:05.376 [DBG] CMGR: Failed to connect to 02fb6f53b5f7363e937bc86b1c99afebdcd52e239b6a632cca37caedad4866d850@127.0.0.1:35947 (reqid 1): dial tcp 127.0.0.1:35947: connect: connection refused
2024-11-21 13:21:05.376 [DBG] CMGR: Retrying connection to 02fb6f53b5f7363e937bc86b1c99afebdcd52e239b6a632cca37caedad4866d850@127.0.0.1:35947 (reqid 1) in 10s
Your environment
- version of
lnd
: 0.18.3 - which operating system (
uname -a
on *Nix): any - version of
btcd
,bitcoind
, or other backend: irrelevant - any other relevant environment details
Steps to reproduce
- Connect two nodes with a channel. Node A and Node B. Set maxbackoff=1s to node A.
- Stop node B
Expected behaviour
A should attempt reconnects every second (respecting maxbackoff)
Actual behaviour
A will attempt reconnects in growing intervals