itest: enable slow mining by default

We now redirect the mineBlocks function to the mineBlocksSlow function
which waits after each mined block. To reduce the overall time impact of
using that function everywhere, we only wait 20 milliseconds instead of 50ms
after each mined block to give all nodes
some time to process the block. This will still slow down everything by a bit
but reduce flakes that are caused by different sub systems not being
up-to-date.
This commit is contained in:
Oliver Gugger 2021-10-01 10:25:49 +02:00
parent 98061dfd58
commit bedba02a2d
No known key found for this signature in database
GPG Key ID: 8E4256593F177720

View File

@ -31,7 +31,7 @@ var (
"lndexec", itestLndBinary, "full path to lnd binary",
)
slowMineDelay = 50 * time.Millisecond
slowMineDelay = 20 * time.Millisecond
)
const (
@ -199,7 +199,7 @@ func waitForNTxsInMempool(miner *rpcclient.Client, n int,
// mineBlocks mine 'num' of blocks and check that blocks are present in
// node blockchain. numTxs should be set to the number of transactions
// (excluding the coinbase) we expect to be included in the first mined block.
func mineBlocks(t *harnessTest, net *lntest.NetworkHarness,
func mineBlocksFast(t *harnessTest, net *lntest.NetworkHarness,
num uint32, numTxs int) []*wire.MsgBlock {
// If we expect transactions to be included in the blocks we'll mine,
@ -240,6 +240,19 @@ func mineBlocks(t *harnessTest, net *lntest.NetworkHarness,
return blocks
}
// mineBlocksSlow mines 'num' of blocks and checks that blocks are present in
// the mining node's blockchain. numTxs should be set to the number of
// transactions (excluding the coinbase) we expect to be included in the first
// mined block. Between each mined block an artificial delay is introduced to
// give all network participants time to catch up.
//
// NOTE: This function currently is just an alias for mineBlocksSlow.
func mineBlocks(t *harnessTest, net *lntest.NetworkHarness,
num uint32, numTxs int) []*wire.MsgBlock {
return mineBlocksSlow(t, net, num, numTxs)
}
// mineBlocksSlow mines 'num' of blocks and checks that blocks are present in
// the mining node's blockchain. numTxs should be set to the number of
// transactions (excluding the coinbase) we expect to be included in the first