[itests] Bitcoind integration test#1583
Conversation
d524723 to
19bfc14
Compare
19bfc14 to
0e292f4
Compare
8c78286 to
5b4296a
Compare
lntest/itest/lnd_test.go
Outdated
There was a problem hiding this comment.
Nit: use harnessNetParams?
lntest/btcd.go
Outdated
There was a problem hiding this comment.
Nit: would be nice if this was provided as a function parameter.
lntest/harness.go
Outdated
There was a problem hiding this comment.
Any insights as to why this had to be increased?
There was a problem hiding this comment.
Because bitcoind was slower to catch up block hashes IIRC. Since this should be faster now I can try to revert this.
lntest/bitcoind.go
Outdated
There was a problem hiding this comment.
IIRC, this is defined elsewhere already?
There was a problem hiding this comment.
It is re-defined since it is behind a different build flag.
|
itests look to be failing with an infrequent error? |
2ac4811 to
190a40c
Compare
Should be fixed by d531fd3 |
|
btw @Roasbeef, any reasons not to switch to regtest also for |
|
Did a couple more travis runs and found the following flakes: |
|
Tracked down the failures above and they should be resolved with the following patch: diff --git a/lntest/bitcoind.go b/lntest/bitcoind.go
index dd0cc5e9..3e7c1d35 100644
--- a/lntest/bitcoind.go
+++ b/lntest/bitcoind.go
@@ -102,6 +102,7 @@ func NewBackend(miner string, netParams *chaincfg.Params) (
"-datadir="+tempBitcoindDir,
"-regtest",
"-txindex",
+ "-debug",
"-whitelist=127.0.0.1", // whitelist localhost to speed up relay
"-rpcauth=weks:469e9bb14ab2360f8e226efed5ca6f"+
"d$507c670e800a95284294edb5773b05544b"+
diff --git a/lntest/itest/lnd_test.go b/lntest/itest/lnd_test.go
index 85212435..c2f9e5ab 100644
--- a/lntest/itest/lnd_test.go
+++ b/lntest/itest/lnd_test.go
@@ -10004,19 +10004,13 @@ func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest) {
// We'll mine defaultCSV blocks in order to generate the sweep
// transaction of Bob's funding output. This will also bring us to the
- // maturity height of the htlc tx output.
+ // maturity height of the htlc tx output, so we should expect to see
+ // both transactions in the mempool.
if _, err := net.Miner.Node.Generate(defaultCSV); err != nil {
t.Fatalf("unable to generate blocks: %v", err)
}
- _, err = waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
- if err != nil {
- t.Fatalf("unable to find bob's funding output sweep tx: %v", err)
- }
-
- // The second layer HTLC timeout transaction should now have been
- // broadcast on-chain.
- secondLayerHash, err := waitForTxInMempool(net.Miner.Node, minerMempoolTimeout)
+ txids, err := waitForNTxsInMempool(net.Miner.Node, 2, minerMempoolTimeout)
if err != nil {
t.Fatalf("unable to find bob's second layer transaction")
}
@@ -10045,12 +10039,14 @@ func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest) {
// Now we'll mine an additional block, which should include the second
// layer sweep tx.
- block := mineBlocks(t, net, 1, 1)[0]
+ block := mineBlocks(t, net, 1, 2)[0]
// The block should have confirmed Bob's second layer sweeping
// transaction. Therefore, at this point, there should be no active
// HTLC's on the commitment transaction from Alice -> Bob.
- assertTxInBlock(t, block, secondLayerHash)
+ for _, txid := range txids {
+ assertTxInBlock(t, block, txid)
+ }
nodes = []*lntest.HarnessNode{net.Alice}
err = lntest.WaitPredicate(func() bool {
predErr = assertNumActiveHtlcs(nodes, 0)
|
|
@wpaulino so the flakes weren't fundamental to |
|
Correct. Things seem to be slower with bitcoind, likely due to the several HTTP requests made. The patch above solves an incorrect assumption within the test itself. We should expect both bob's commit sweep and HTLC timeout transactions in the mempool before proceeding. Without the patch we'd only wait for one of these twice, causing us to proceed with further assumptions that rely on this one. |
|
This PR should now be rebased on top of #3434 in order to address the flake pointed out above. |
190a40c to
f5b5fd4
Compare
…annel Otherwise following tests would be flaky because of unexpected sweep transaction in the mempool.
Co-authored-by: Wilmer Paulino <wilmer.paulino@gmail.com>
f5b5fd4 to
c3480c6
Compare
The local timeout could be too short for certain backends.
|
Looks good after rebase on #3434 👍 |
| "bitcoind", | ||
| "-datadir="+tempBitcoindDir, | ||
| "-regtest", | ||
| "-txindex", |
There was a problem hiding this comment.
Should we run without this? Would ensure that the fallback path (no txindex, scan manually) is tested instead.
There was a problem hiding this comment.
We could run it with both options, though this would significantly increase the running time of the current integration tests. On the other hand, we properly test both variants in the unit tests of the notifier.
There was a problem hiding this comment.
Could randomize it lol
This PR enables the
bitcoindbackend for integration tests.