Merge pull request #9977 from starius/itest-bitcoind-neutrino

lntest: enable neutrino testing with bitcoind
This commit is contained in:
Yong
2025-06-23 17:08:18 +08:00
committed by GitHub
5 changed files with 23 additions and 1 deletions

View File

@@ -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

View File

@@ -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,
@@ -124,13 +129,15 @@ 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,
"-debug",
"-debugexclude=libevent",
"-debuglogfile=" + logFile,
"-blockfilterindex",
"-peerblockfilters",
}
cmdArgs = append(cmdArgs, extraArgs...)
bitcoind := exec.Command("bitcoind", cmdArgs...)

View File

@@ -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.

View File

@@ -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) {

View File

@@ -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.