build: update btcwallet dependency introducing pruned bitcoind support

This is achieved by some recent work within the BitcoindClient enabling
it to retrieve pruned blocks from its server's peers.
This commit is contained in:
Wilmer Paulino 2021-03-09 14:12:26 -08:00
parent d1c7059f14
commit 82fe5d9bba
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F
7 changed files with 61 additions and 24 deletions

View File

@ -233,10 +233,19 @@ func NewBitcoindBackend(t *testing.T, minerAddr string,
time.Sleep(time.Second)
host := fmt.Sprintf("127.0.0.1:%d", rpcPort)
conn, err := chain.NewBitcoindConn(
NetParams, host, "weks", "weks", zmqBlockHost, zmqTxHost,
100*time.Millisecond,
)
conn, err := chain.NewBitcoindConn(&chain.BitcoindConfig{
ChainParams: NetParams,
Host: host,
User: "weks",
Pass: "weks",
ZMQBlockHost: zmqBlockHost,
ZMQTxHost: zmqTxHost,
ZMQReadDeadline: 5 * time.Second,
// Fields only required for pruned nodes, not needed for these
// tests.
Dialer: nil,
PrunedModeMaxPeers: 0,
})
if err != nil {
bitcoind.Process.Kill()
bitcoind.Wait()

View File

@ -105,6 +105,11 @@ type Config struct {
// DBTimeOut specifies the timeout value to use when opening the wallet
// database.
DBTimeOut time.Duration
// Dialer is a function closure that will be used to establish outbound
// TCP connections to Bitcoin peers in the event of a pruned block being
// requested.
Dialer chain.Dialer
}
const (
@ -383,12 +388,16 @@ func NewChainControl(cfg *Config) (*ChainControl, error) {
// Establish the connection to bitcoind and create the clients
// required for our relevant subsystems.
bitcoindConn, err := chain.NewBitcoindConn(
cfg.ActiveNetParams.Params, bitcoindHost,
bitcoindMode.RPCUser, bitcoindMode.RPCPass,
bitcoindMode.ZMQPubRawBlock, bitcoindMode.ZMQPubRawTx,
5*time.Second,
)
bitcoindConn, err := chain.NewBitcoindConn(&chain.BitcoindConfig{
ChainParams: cfg.ActiveNetParams.Params,
Host: bitcoindHost,
User: bitcoindMode.RPCUser,
Pass: bitcoindMode.RPCPass,
ZMQBlockHost: bitcoindMode.ZMQPubRawBlock,
ZMQTxHost: bitcoindMode.ZMQPubRawTx,
ZMQReadDeadline: 5 * time.Second,
Dialer: cfg.Dialer,
})
if err != nil {
return nil, err
}

2
go.mod
View File

@ -9,7 +9,7 @@ require (
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
github.com/btcsuite/btcutil/psbt v1.0.3-0.20201208143702-a53e38424cce
github.com/btcsuite/btcwallet v0.11.1-0.20210329233242-e0607006dce6
github.com/btcsuite/btcwallet v0.11.1-0.20210405201449-683061f79797
github.com/btcsuite/btcwallet/wallet/txauthor v1.0.1-0.20210329233242-e0607006dce6
github.com/btcsuite/btcwallet/wallet/txrules v1.0.0
github.com/btcsuite/btcwallet/wallet/txsizes v1.0.1-0.20210329233242-e0607006dce6 // indirect

6
go.sum
View File

@ -25,8 +25,8 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce
github.com/btcsuite/btcd v0.0.0-20190629003639-c26ffa870fd8/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.20.1-beta.0.20200513120220-b470eee47728/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.21.0-beta.0.20201208033208-6bd4c64a54fa/go.mod h1:Sv4JPQ3/M+teHz9Bo5jBpkNcP0x6r7rdihlNL/7tTAs=
github.com/btcsuite/btcd v0.21.0-beta.0.20210316172410-f86ae60936d7/go.mod h1:Sv4JPQ3/M+teHz9Bo5jBpkNcP0x6r7rdihlNL/7tTAs=
github.com/btcsuite/btcd v0.21.0-beta.0.20210401013323-36a96f6a0025 h1:aoVqvZk4mLyF3WZbqEVPq+vXnwL2wekZg4P4mjYJNLs=
github.com/btcsuite/btcd v0.21.0-beta.0.20210401013323-36a96f6a0025/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
@ -37,8 +37,8 @@ github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pY
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o=
github.com/btcsuite/btcutil/psbt v1.0.3-0.20201208143702-a53e38424cce h1:3PRwz+js0AMMV1fHRrCdQ55akoomx4Q3ulozHC3BDDY=
github.com/btcsuite/btcutil/psbt v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:LVveMu4VaNSkIRTZu2+ut0HDBRuYjqGocxDMNS1KuGQ=
github.com/btcsuite/btcwallet v0.11.1-0.20210329233242-e0607006dce6 h1:5Y6ui667YQrFCxPYV4Pmf9jpEsIkcJxMKsXJzNsMU9o=
github.com/btcsuite/btcwallet v0.11.1-0.20210329233242-e0607006dce6/go.mod h1:JBUz2SCnYLn2Dw9bcnqZYvKchnKVvWSLv8OUzihHTcc=
github.com/btcsuite/btcwallet v0.11.1-0.20210405201449-683061f79797 h1:FqPzyVNKoqE+qV57Cn8zpTfUy/G698M9b6dNprGj0cY=
github.com/btcsuite/btcwallet v0.11.1-0.20210405201449-683061f79797/go.mod h1:CevOfPKvF6kHr+JXhWD3TtqLbsJrD1CzrtDqZ+5G6ss=
github.com/btcsuite/btcwallet/wallet/txauthor v1.0.0/go.mod h1:VufDts7bd/zs3GV13f/lXc/0lXrPnvxD/NvmpG/FEKU=
github.com/btcsuite/btcwallet/wallet/txauthor v1.0.1-0.20210329233242-e0607006dce6 h1:mO7NxcfgLe75paLDHx+LWNG5BskiDQigHnSVT2KvNZA=
github.com/btcsuite/btcwallet/wallet/txauthor v1.0.1-0.20210329233242-e0607006dce6/go.mod h1:VufDts7bd/zs3GV13f/lXc/0lXrPnvxD/NvmpG/FEKU=

3
lnd.go
View File

@ -543,6 +543,9 @@ func Main(cfg *Config, lisCfg ListenerCfg, interceptor signal.Interceptor) error
NeutrinoCS: neutrinoCS,
ActiveNetParams: cfg.ActiveNetParams,
FeeURL: cfg.FeeURL,
Dialer: func(addr string) (net.Conn, error) {
return cfg.net.Dial("tcp", addr, cfg.ConnectionTimeout)
},
}
activeChainControl, err := chainreg.NewChainControl(chainControlCfg)

View File

@ -3323,11 +3323,19 @@ func runTests(t *testing.T, walletDriver *lnwallet.WalletDriver,
host := fmt.Sprintf("127.0.0.1:%d", rpcPort)
var chainConn *chain.BitcoindConn
err = wait.NoError(func() error {
chainConn, err = chain.NewBitcoindConn(
netParams, host, "weks", "weks",
zmqBlockHost, zmqTxHost,
100*time.Millisecond,
)
chainConn, err = chain.NewBitcoindConn(&chain.BitcoindConfig{
ChainParams: netParams,
Host: host,
User: "weks",
Pass: "weks",
ZMQBlockHost: zmqBlockHost,
ZMQTxHost: zmqTxHost,
ZMQReadDeadline: 5 * time.Second,
// Fields only required for pruned nodes, not
// needed for these tests.
Dialer: nil,
PrunedModeMaxPeers: 0,
})
if err != nil {
return err
}

View File

@ -816,11 +816,19 @@ var interfaceImpls = []struct {
time.Sleep(time.Second)
host := fmt.Sprintf("127.0.0.1:%d", rpcPort)
chainConn, err := chain.NewBitcoindConn(
&chaincfg.RegressionNetParams, host, "weks",
"weks", zmqBlockHost, zmqTxHost,
100*time.Millisecond,
)
chainConn, err := chain.NewBitcoindConn(&chain.BitcoindConfig{
ChainParams: &chaincfg.RegressionNetParams,
Host: host,
User: "weks",
Pass: "weks",
ZMQBlockHost: zmqBlockHost,
ZMQTxHost: zmqTxHost,
ZMQReadDeadline: 5 * time.Second,
// Fields only required for pruned nodes, not
// needed for these tests.
Dialer: nil,
PrunedModeMaxPeers: 0,
})
if err != nil {
return cleanUp2, nil, fmt.Errorf("unable to "+
"establish connection to bitcoind: %v",