mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-05 17:05:50 +02:00
lntest: make sure chain backend is synced to miner
We sometimes see `timeout waiting for UTXOs` error from bitcoind-related itests due to the chain backend not synced to the miner. We now assert it's synced before continue.
This commit is contained in:
@@ -481,6 +481,14 @@ func (h *HarnessTest) NewNode(name string,
|
||||
err = node.Start(h.runCtx)
|
||||
require.NoError(h, err, "failed to start node %s", node.Name())
|
||||
|
||||
// Get the miner's best block hash.
|
||||
bestBlock, err := h.miner.Client.GetBestBlockHash()
|
||||
require.NoError(h, err, "unable to get best block hash")
|
||||
|
||||
// Wait until the node's chain backend is synced to the miner's best
|
||||
// block.
|
||||
h.WaitForBlockchainSyncTo(node, *bestBlock)
|
||||
|
||||
return node
|
||||
}
|
||||
|
||||
@@ -490,12 +498,7 @@ func (h *HarnessTest) NewNode(name string,
|
||||
func (h *HarnessTest) NewNodeWithCoins(name string,
|
||||
extraArgs []string) *node.HarnessNode {
|
||||
|
||||
node, err := h.manager.newNode(h.T, name, extraArgs, nil, false)
|
||||
require.NoErrorf(h, err, "unable to create new node for %s", name)
|
||||
|
||||
// Start the node.
|
||||
err = node.Start(h.runCtx)
|
||||
require.NoError(h, err, "failed to start node %s", node.Name())
|
||||
node := h.NewNode(name, extraArgs)
|
||||
|
||||
// Load up the wallets of the node with 5 outputs of 1 BTC each.
|
||||
const (
|
||||
|
Reference in New Issue
Block a user