multi: update to latest btcd version

With this commit we update btcd to the latest version which allows us to
specify the btcd binary we want to use when spinning up a new node.
This commit is contained in:
Oliver Gugger 2020-12-03 11:30:22 +01:00
parent c58589db3b
commit 2edc3cf98f
No known key found for this signature in database
GPG Key ID: 8E4256593F177720
9 changed files with 42 additions and 19 deletions

@ -1067,7 +1067,9 @@ func testReorgConf(miner *rpctest.Harness,
notifier chainntnfs.TestChainNotifier, scriptDispatch bool, t *testing.T) { notifier chainntnfs.TestChainNotifier, scriptDispatch bool, t *testing.T) {
// Set up a new miner that we can use to cause a reorg. // Set up a new miner that we can use to cause a reorg.
miner2, err := rpctest.New(chainntnfs.NetParams, nil, []string{"--txindex"}) miner2, err := rpctest.New(
chainntnfs.NetParams, nil, []string{"--txindex"}, "",
)
if err != nil { if err != nil {
t.Fatalf("unable to create mining node: %v", err) t.Fatalf("unable to create mining node: %v", err)
} }
@ -1247,7 +1249,9 @@ func testReorgSpend(miner *rpctest.Harness,
} }
// Set up a new miner that we can use to cause a reorg. // Set up a new miner that we can use to cause a reorg.
miner2, err := rpctest.New(chainntnfs.NetParams, nil, []string{"--txindex"}) miner2, err := rpctest.New(
chainntnfs.NetParams, nil, []string{"--txindex"}, "",
)
if err != nil { if err != nil {
t.Fatalf("unable to create mining node: %v", err) t.Fatalf("unable to create mining node: %v", err)
} }
@ -1592,7 +1596,9 @@ func testCatchUpOnMissedBlocksWithReorg(miner1 *rpctest.Harness,
var wg sync.WaitGroup var wg sync.WaitGroup
// Set up a new miner that we can use to cause a reorg. // Set up a new miner that we can use to cause a reorg.
miner2, err := rpctest.New(chainntnfs.NetParams, nil, []string{"--txindex"}) miner2, err := rpctest.New(
chainntnfs.NetParams, nil, []string{"--txindex"}, "",
)
if err != nil { if err != nil {
t.Fatalf("unable to create mining node: %v", err) t.Fatalf("unable to create mining node: %v", err)
} }

@ -177,7 +177,7 @@ func NewMiner(t *testing.T, extraArgs []string, createChain bool,
trickle := fmt.Sprintf("--trickleinterval=%v", TrickleInterval) trickle := fmt.Sprintf("--trickleinterval=%v", TrickleInterval)
extraArgs = append(extraArgs, trickle) extraArgs = append(extraArgs, trickle)
node, err := rpctest.New(NetParams, nil, extraArgs) node, err := rpctest.New(NetParams, nil, extraArgs, "")
if err != nil { if err != nil {
t.Fatalf("unable to create backend node: %v", err) t.Fatalf("unable to create backend node: %v", err)
} }

2
go.mod

@ -5,7 +5,7 @@ require (
github.com/NebulousLabs/fastrand v0.0.0-20181203155948-6fb6489aac4e // indirect github.com/NebulousLabs/fastrand v0.0.0-20181203155948-6fb6489aac4e // indirect
github.com/NebulousLabs/go-upnp v0.0.0-20180202185039-29b680b06c82 github.com/NebulousLabs/go-upnp v0.0.0-20180202185039-29b680b06c82
github.com/Yawning/aez v0.0.0-20180114000226-4dad034d9db2 github.com/Yawning/aez v0.0.0-20180114000226-4dad034d9db2
github.com/btcsuite/btcd v0.20.1-beta.0.20200903105316-61634447e719 github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
github.com/btcsuite/btcutil v1.0.2 github.com/btcsuite/btcutil v1.0.2
github.com/btcsuite/btcutil/psbt v1.0.3-0.20200826194809-5f93e33af2b0 github.com/btcsuite/btcutil/psbt v1.0.3-0.20200826194809-5f93e33af2b0

4
go.sum

@ -27,8 +27,8 @@ github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcug
github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= 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.20.1-beta.0.20200513120220-b470eee47728/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.20.1-beta.0.20200903105316-61634447e719 h1:EVCN2/T2EhbccMSuV3iM6cVcVVYSzmsx4EP3fWgdFGQ= github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401 h1:0tjUthKCaF8zwF9Qg7lfnep0xdo4n8WiFUfQPaMHX6g=
github.com/btcsuite/btcd v0.20.1-beta.0.20200903105316-61634447e719/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401/go.mod h1:Sv4JPQ3/M+teHz9Bo5jBpkNcP0x6r7rdihlNL/7tTAs=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng=

@ -88,7 +88,7 @@ func NewBackend(miner string, netParams *chaincfg.Params) (
// make sure they stay connected if it happens. // make sure they stay connected if it happens.
"--nobanning", "--nobanning",
} }
chainBackend, err := rpctest.New(netParams, nil, args) chainBackend, err := rpctest.New(netParams, nil, args, GetBtcdBinary())
if err != nil { if err != nil {
return nil, nil, fmt.Errorf("unable to create btcd node: %v", err) return nil, nil, fmt.Errorf("unable to create btcd node: %v", err)
} }

@ -2471,8 +2471,8 @@ func testOpenChannelAfterReorg(net *lntest.NetworkHarness, t *harnessTest) {
tempLogDir := fmt.Sprintf("%s/.tempminerlogs", lntest.GetLogDir()) tempLogDir := fmt.Sprintf("%s/.tempminerlogs", lntest.GetLogDir())
logFilename := "output-open_channel_reorg-temp_miner.log" logFilename := "output-open_channel_reorg-temp_miner.log"
tempMiner, tempMinerCleanUp, err := lntest.NewMiner( tempMiner, tempMinerCleanUp, err := lntest.NewMiner(
tempLogDir, logFilename, tempLogDir, logFilename, harnessNetParams,
harnessNetParams, &rpcclient.NotificationHandlers{}, &rpcclient.NotificationHandlers{}, lntest.GetBtcdBinary(),
) )
require.NoError(t.t, err, "failed to create temp miner") require.NoError(t.t, err, "failed to create temp miner")
defer func() { defer func() {
@ -14258,8 +14258,8 @@ func TestLightningNetworkDaemon(t *testing.T) {
// We will also connect it to our chain backend. // We will also connect it to our chain backend.
minerLogDir := fmt.Sprintf("%s/.minerlogs", logDir) minerLogDir := fmt.Sprintf("%s/.minerlogs", logDir)
miner, minerCleanUp, err := lntest.NewMiner( miner, minerCleanUp, err := lntest.NewMiner(
minerLogDir, "output_btcd_miner.log", minerLogDir, "output_btcd_miner.log", harnessNetParams,
harnessNetParams, &rpcclient.NotificationHandlers{}, &rpcclient.NotificationHandlers{}, lntest.GetBtcdBinary(),
) )
require.NoError(t, err, "failed to create new miner") require.NoError(t, err, "failed to create new miner")
defer func() { defer func() {

@ -78,6 +78,11 @@ var (
// goroutines of test nodes on failure. // goroutines of test nodes on failure.
goroutineDump = flag.Bool("goroutinedump", false, goroutineDump = flag.Bool("goroutinedump", false,
"write goroutine dump from node n to file pprof-n.log") "write goroutine dump from node n to file pprof-n.log")
// btcdExecutable is the full path to the btcd binary.
btcdExecutable = flag.String(
"btcdexec", "", "full path to btcd binary",
)
) )
// nextAvailablePort returns the first port that is available for listening by // nextAvailablePort returns the first port that is available for listening by
@ -123,6 +128,16 @@ func GetLogDir() string {
return "." return "."
} }
// GetBtcdBinary returns the full path to the binary of the custom built btcd
// executable or an empty string if none is set.
func GetBtcdBinary() string {
if btcdExecutable != nil {
return *btcdExecutable
}
return ""
}
// generateListeningPorts returns four ints representing ports to listen on // generateListeningPorts returns four ints representing ports to listen on
// designated for the current lightning network test. This returns the next // designated for the current lightning network test. This returns the next
// available ports for the p2p, rpc, rest and profiling services. // available ports for the p2p, rpc, rest and profiling services.
@ -394,8 +409,8 @@ func newNode(cfg NodeConfig) (*HarnessNode, error) {
// miner node's log dir. When tests finished, during clean up, its logs are // miner node's log dir. When tests finished, during clean up, its logs are
// copied to a file specified as logFilename. // copied to a file specified as logFilename.
func NewMiner(logDir, logFilename string, netParams *chaincfg.Params, func NewMiner(logDir, logFilename string, netParams *chaincfg.Params,
handler *rpcclient.NotificationHandlers) (*rpctest.Harness, handler *rpcclient.NotificationHandlers,
func() error, error) { btcdBinary string) (*rpctest.Harness, func() error, error) {
args := []string{ args := []string{
"--rejectnonstd", "--rejectnonstd",
@ -407,7 +422,7 @@ func NewMiner(logDir, logFilename string, netParams *chaincfg.Params,
"--trickleinterval=100ms", "--trickleinterval=100ms",
} }
miner, err := rpctest.New(netParams, handler, args) miner, err := rpctest.New(netParams, handler, args, btcdBinary)
if err != nil { if err != nil {
return nil, nil, fmt.Errorf( return nil, nil, fmt.Errorf(
"unable to create mining node: %v", err, "unable to create mining node: %v", err,

@ -2187,7 +2187,7 @@ func testReorgWalletBalance(r *rpctest.Harness, w *lnwallet.LightningWallet,
// Now we cause a reorganization as follows. // Now we cause a reorganization as follows.
// Step 1: create a new miner and start it. // Step 1: create a new miner and start it.
r2, err := rpctest.New(r.ActiveNet, nil, []string{"--txindex"}) r2, err := rpctest.New(r.ActiveNet, nil, []string{"--txindex"}, "")
if err != nil { if err != nil {
t.Fatalf("unable to create mining node: %v", err) t.Fatalf("unable to create mining node: %v", err)
} }
@ -3093,7 +3093,9 @@ func TestLightningWallet(t *testing.T) {
// dedicated miner to generate blocks, cause re-orgs, etc. We'll set // dedicated miner to generate blocks, cause re-orgs, etc. We'll set
// up this node with a chain length of 125, so we have plenty of BTC // up this node with a chain length of 125, so we have plenty of BTC
// to play around with. // to play around with.
miningNode, err := rpctest.New(netParams, nil, []string{"--txindex"}) miningNode, err := rpctest.New(
netParams, nil, []string{"--txindex"}, "",
)
if err != nil { if err != nil {
t.Fatalf("unable to create mining node: %v", err) t.Fatalf("unable to create mining node: %v", err)
} }

@ -540,7 +540,7 @@ func testFilterBlockDisconnected(node *rpctest.Harness,
// Create a node that has a shorter chain than the main chain, so we // Create a node that has a shorter chain than the main chain, so we
// can trigger a reorg. // can trigger a reorg.
reorgNode, err := rpctest.New(netParams, nil, []string{"--txindex"}) reorgNode, err := rpctest.New(netParams, nil, []string{"--txindex"}, "")
if err != nil { if err != nil {
t.Fatalf("unable to create mining node: %v", err) t.Fatalf("unable to create mining node: %v", err)
} }
@ -902,7 +902,7 @@ func TestFilteredChainView(t *testing.T) {
// dedicated miner to generate blocks, cause re-orgs, etc. We'll set up // dedicated miner to generate blocks, cause re-orgs, etc. We'll set up
// this node with a chain length of 125, so we have plenty of BTC to // this node with a chain length of 125, so we have plenty of BTC to
// play around with. // play around with.
miner, err := rpctest.New(netParams, nil, []string{"--txindex"}) miner, err := rpctest.New(netParams, nil, []string{"--txindex"}, "")
if err != nil { if err != nil {
t.Fatalf("unable to create mining node: %v", err) t.Fatalf("unable to create mining node: %v", err)
} }