From 3d0031435c2f6da16c788ec5548a30c28751b665 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Fri, 20 Jun 2025 17:34:00 -0300 Subject: [PATCH 1/4] lntest: serve compact filters for neutrino Enable this in bitcoind mode as well to be able to let a subset of LND nodes to use neutrino with bitcoind backend. --- lntest/bitcoind_common.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lntest/bitcoind_common.go b/lntest/bitcoind_common.go index c66532bbc..36d6aa8b9 100644 --- a/lntest/bitcoind_common.go +++ b/lntest/bitcoind_common.go @@ -131,6 +131,8 @@ func newBackend(miner string, netParams *chaincfg.Params, extraArgs []string, "-debug", "-debugexclude=libevent", "-debuglogfile=" + logFile, + "-blockfilterindex", + "-peerblockfilters", } cmdArgs = append(cmdArgs, extraArgs...) bitcoind := exec.Command("bitcoind", cmdArgs...) From 07217f2dd8db11354c894c33dc7aab9adea5f799 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sun, 22 Jun 2025 01:11:19 -0300 Subject: [PATCH 2/4] lntest: fix p2p port binding Use an additional -bind flag instead of -port to specify the default p2p port. Flag -port sets the default port number that will be used for any -bind or -whitebind that does not explicitly specify a port. So if we have the p2p port set in -port and the tor p2p port set in a single -bind, bitcoind binds only one port - the tor p2p port. And the default p2p port remained not bound! --- lntest/bitcoind_common.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lntest/bitcoind_common.go b/lntest/bitcoind_common.go index 36d6aa8b9..ed3c45f02 100644 --- a/lntest/bitcoind_common.go +++ b/lntest/bitcoind_common.go @@ -124,7 +124,7 @@ func newBackend(miner string, netParams *chaincfg.Params, extraArgs []string, "d$507c670e800a95284294edb5773b05544b" + "220110063096c221be9933c82d38e1", fmt.Sprintf("-rpcport=%d", rpcPort), - fmt.Sprintf("-port=%d", p2pPort), + fmt.Sprintf("-bind=127.0.0.1:%d", p2pPort), fmt.Sprintf("-bind=127.0.0.1:%d=onion", torBindPort), "-zmqpubrawblock=" + zmqBlockAddr, "-zmqpubrawtx=" + zmqTxAddr, From 9100be5ba53af32e3c7133013fdfb518442b36d1 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sat, 21 Jun 2025 12:19:31 -0300 Subject: [PATCH 3/4] lntest: add method P2PAddr to backend It is useful if we want to keep bitcoind main itest mode, but connect one node using neutrino. --- lntest/bitcoind_common.go | 5 +++++ lntest/btcd.go | 5 +++++ lntest/neutrino.go | 5 +++++ lntest/node/config.go | 3 +++ 4 files changed, 18 insertions(+) diff --git a/lntest/bitcoind_common.go b/lntest/bitcoind_common.go index ed3c45f02..6d5cacc43 100644 --- a/lntest/bitcoind_common.go +++ b/lntest/bitcoind_common.go @@ -85,6 +85,11 @@ func (b BitcoindBackendConfig) Name() string { return "bitcoind" } +// P2PAddr return bitcoin p2p ip:port. +func (b BitcoindBackendConfig) P2PAddr() (string, error) { + return fmt.Sprintf("127.0.0.1:%d", b.p2pPort), nil +} + // newBackend starts a bitcoind node with the given extra parameters and returns // a BitcoindBackendConfig for that node. func newBackend(miner string, netParams *chaincfg.Params, extraArgs []string, diff --git a/lntest/btcd.go b/lntest/btcd.go index 91b25411c..21c343243 100644 --- a/lntest/btcd.go +++ b/lntest/btcd.go @@ -74,6 +74,11 @@ func (b BtcdBackendConfig) Name() string { return "btcd" } +// P2PAddr return bitcoin p2p ip:port. +func (b BtcdBackendConfig) P2PAddr() (string, error) { + return b.harness.P2PAddress(), nil +} + // NewBackend starts a new rpctest.Harness and returns a BtcdBackendConfig for // that node. miner should be set to the P2P address of the miner to connect // to. diff --git a/lntest/neutrino.go b/lntest/neutrino.go index 11f13612f..568007097 100644 --- a/lntest/neutrino.go +++ b/lntest/neutrino.go @@ -54,6 +54,11 @@ func (b NeutrinoBackendConfig) Name() string { return NeutrinoBackendName } +// P2PAddr return bitcoin p2p ip:port. +func (b NeutrinoBackendConfig) P2PAddr() (string, error) { + return b.minerAddr, nil +} + // NewBackend starts and returns a NeutrinoBackendConfig for the node. func NewBackend(miner string, _ *chaincfg.Params) ( *NeutrinoBackendConfig, func() error, error) { diff --git a/lntest/node/config.go b/lntest/node/config.go index 168dc87ec..bd003eb01 100644 --- a/lntest/node/config.go +++ b/lntest/node/config.go @@ -114,6 +114,9 @@ type BackendConfig interface { // Credentials returns the rpc username, password and host for the // backend. Credentials() (string, string, string, error) + + // P2PAddr return bitcoin p2p ip:port. + P2PAddr() (string, error) } // BaseNodeConfig is the base node configuration. From 7b70ad7fd1857d1f1044ccded6b7ad900032580d Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sun, 22 Jun 2025 11:05:45 -0300 Subject: [PATCH 4/4] docs: update release notes --- docs/release-notes/release-notes-0.20.0.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release-notes/release-notes-0.20.0.md b/docs/release-notes/release-notes-0.20.0.md index e2af27a96..3ba247cb9 100644 --- a/docs/release-notes/release-notes-0.20.0.md +++ b/docs/release-notes/release-notes-0.20.0.md @@ -131,6 +131,8 @@ circuit. The indices are only available for forwarding events saved after v0.20. ## Tooling and Documentation +* lntest: [enable neutrino testing with bitcoind](https://github.com/lightningnetwork/lnd/pull/9977) + # Contributors (Alphabetical Order) * Abdulkbk