lntest: disable bitcoind v2 P2P transport in itests
What changed, and why it matters
This change only affects internal test setup code. It adds a command-line flag to bitcoind test instances so they use an older version of the Bitcoin peer-to-peer protocol, because the test miner software (btcd) does not yet support the newer protocol. This prevents 30-second handshake timeouts that were making tests flaky. It is not a security fix and does not change production LND behavior.
No security action required. This is a test reliability improvement. Reviewers may optionally verify that the TODO to re-enable v2 transport once btcd supports it is tracked.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies lntest/bitcoind_common.go and lntest/miner/bitcoind_miner.go to pass -v2transport=0 when launching bitcoind for integration tests. bitcoind v29 defaults to attempting BIP324 v2 P2P transport, but the btcd miner used in tests does not support it, causing a 30-second fallback delay that exhausts DefaultTimeout in tests relying on prompt block propagation after reconnect. The same flag was already used in the unit test backend. No production code is changed.
Changed components
lntest/bitcoind_common.golntest/miner/bitcoind_miner.goInspect captured patch +15 / −0
diff --git a/lntest/bitcoind_common.go b/lntest/bitcoind_common.go
index cc78837..5f776de 100644
--- a/lntest/bitcoind_common.go
+++ b/lntest/bitcoind_common.go
@@ -173,6 +173,14 @@ func newBackend(miner string, netParams *chaincfg.Params, extraArgs []string,
"-debuglogfile=" + logFile,
"-blockfilterindex",
"-peerblockfilters",
+ // Disable v2 transport since the miner is btcd, which
+ // doesn't support v2 yet. Without this, bitcoind
+ // attempts a v2 handshake that hangs for 30s before
+ // falling back to v1, causing test flakes whenever a
+ // test reconnects to the miner under a timeout.
+ //
+ // TODO: Remove once btcd supports v2 P2P transport.
+ "-v2transport=0",
}
cmdArgs = append(cmdArgs, extraArgs...)
bitcoind := exec.Command("bitcoind", cmdArgs...)
diff --git a/lntest/miner/bitcoind_miner.go b/lntest/miner/bitcoind_miner.go
index c390b36..2c77a9d 100644
--- a/lntest/miner/bitcoind_miner.go
+++ b/lntest/miner/bitcoind_miner.go
@@ -163,6 +163,13 @@ func (b *BitcoindMinerBackend) Start(setupChain bool,
"-debuglogfile=" + logFile,
// Set fallback fee for transaction creation.
"-fallbackfee=0.00001",
+ // Disable v2 transport since this backend may peer with
+ // btcd nodes that don't support v2 yet. Without this,
+ // bitcoind attempts a v2 handshake that hangs for 30s
+ // before falling back to v1.
+ //
+ // TODO: Remove once btcd supports v2 P2P transport.
+ "-v2transport=0",
}
cmdArgs = append(cmdArgs, b.extraArgs...)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.