Skip to content

lnwallet/btcwallet: skip 2-hour tip-staleness check on local networks (alternate) - #11003

Open
ZZiigguurraatt wants to merge 1 commit into
lightningnetwork:masterfrom
ZZiigguurraatt:issync-skip-stale-tip-regtest2
Open

lnwallet/btcwallet: skip 2-hour tip-staleness check on local networks (alternate)#11003
ZZiigguurraatt wants to merge 1 commit into
lightningnetwork:masterfrom
ZZiigguurraatt:issync-skip-stale-tip-regtest2

Conversation

@ZZiigguurraatt

@ZZiigguurraatt ZZiigguurraatt commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

IsSynced rejected "synced" status whenever the best block header timestamp was more than 2 hours in the past. On regtest and simnet blocks are only mined on demand, so an idle chain would drive the tip timestamp past that window and report synced_to_chain=false, and could block the startup sync loop indefinitely.

Add an IsLocalNet field to the wallet Config, populated from the existing lncfg.Chain.IsLocalNetwork() so the "local network" definition stays in one place, and skip the staleness check when it is set. Mainnet and testnet are unaffected. Also rename the misleading minus24Hours variable to minus2Hours.

Add TestIsSyncedStaleTip covering the skip when IsLocalNet is set, the still-enforced check when it is not, and a fresh-tip baseline.

Alternative to #11002

Fixes #11004

IsSynced rejected "synced" status whenever the best block header
timestamp was more than 2 hours in the past. On regtest and simnet
blocks are only mined on demand, so an idle chain would drive the tip
timestamp past that window and report synced_to_chain=false, and could
block the startup sync loop indefinitely.

Add an IsLocalNet field to the wallet Config, populated from the
existing lncfg.Chain.IsLocalNetwork() so the "local network" definition
stays in one place, and skip the staleness check when it is set. Mainnet
and testnet are unaffected. Also rename the misleading minus24Hours
variable to minus2Hours.

Add TestIsSyncedStaleTip covering the skip when IsLocalNet is set, the
still-enforced check when it is not, and a fresh-tip baseline.
@ZZiigguurraatt

Copy link
Copy Markdown
Contributor Author

@ZZiigguurraatt

Copy link
Copy Markdown
Contributor Author

Alternative to #11002

See ZZiigguurraatt/lnd@issync-skip-stale-tip-regtest...ZZiigguurraatt:lnd:issync-skip-stale-tip-regtest2

Actually, please ignore this link. GitHub is not doing the diff correctly. Run locally with

git diff issync-skip-stale-tip-regtest issync-skip-stale-tip-regtest2

to get the correct diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 hour stale block check should not hang up regtest networks

1 participant