Merge pull request #2160 from halseth/integration-tests-mine-reorged-funding-tx

[Integration tests] mine reorged funding tx
This commit is contained in:
Johan T. Halseth 2018-11-09 08:48:09 +01:00 committed by GitHub
commit 1516ceb37a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 3 deletions

@ -42,7 +42,12 @@ var (
)
const (
testFeeBase = 1e+6
testFeeBase = 1e+6
defaultCSV = lntest.DefaultCSV
defaultTimeout = lntest.DefaultTimeout
minerMempoolTimeout = lntest.MinerMempoolTimeout
channelOpenTimeout = lntest.ChannelOpenTimeout
channelCloseTimeout = lntest.ChannelCloseTimeout
)
// harnessTest wraps a regular testing.T providing enhanced error detection
@ -1555,7 +1560,16 @@ func testOpenChannelAfterReorg(net *lntest.NetworkHarness, t *harnessTest) {
numEdges)
}
ctxt, _ = context.WithTimeout(ctxb, timeout)
// Cleanup by mining the funding tx again, then closing the channel.
_, err = waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
if err != nil {
t.Fatalf("failed to find funding tx in mempool: %v", err)
}
block = mineBlocks(t, net, 1)[0]
assertTxInBlock(t, block, fundingTxID)
ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout)
closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, false)
}

@ -22,6 +22,28 @@ import (
"github.com/lightningnetwork/lnd/lnwire"
)
const (
// DefaultCSV is the CSV delay (remotedelay) we will start our test
// nodes with.
DefaultCSV = 4
// MinerMempoolTimeout is the max time we will wait for a transaction
// to propagate to the mining node's mempool.
MinerMempoolTimeout = time.Second * 30
// ChannelOpenTimeout is the max time we will wait before a channel to
// be considered opened.
ChannelOpenTimeout = time.Second * 30
// ChannelCloseTimeout is the max time we will wait before a channel is
// considered closed.
ChannelCloseTimeout = time.Second * 30
// DefaultTimeout is a timeout that will be used for various wait
// scenarios where no custom timeout value is defined.
DefaultTimeout = time.Second * 30
)
// NetworkHarness is an integration testing harness for the lightning network.
// The harness by default is created with two active nodes on the network:
// Alice and Bob.

@ -148,7 +148,7 @@ func (cfg nodeConfig) genArgs() []string {
args = append(args, "--nobootstrap")
args = append(args, "--debuglevel=debug")
args = append(args, "--bitcoin.defaultchanconfs=1")
args = append(args, "--bitcoin.defaultremotedelay=4")
args = append(args, fmt.Sprintf("--bitcoin.defaultremotedelay=%v", DefaultCSV))
args = append(args, fmt.Sprintf("--btcd.rpchost=%v", cfg.RPCConfig.Host))
args = append(args, fmt.Sprintf("--btcd.rpcuser=%v", cfg.RPCConfig.User))
args = append(args, fmt.Sprintf("--btcd.rpcpass=%v", cfg.RPCConfig.Pass))