Merge pull request #7126 from yyforyongyu/temp-fix-itest

itest+funding: decrease sleep time and add a temporary fix for itest
This commit is contained in:
Olaoluwa Osuntokun authored and GitHub committed 2022-11-10 16:53:44 -08:00
commit bcdf24b15e
5 files changed
+33 -4

No files matched your search

+2 -2
View File
@@ -149,8 +149,8 @@ certain large transactions](https://github.com/lightningnetwork/lnd/pull/7100).
so that the user can specify fees during channel creation time in addition so that the user can specify fees during channel creation time in addition
to the default configuration. to the default configuration.
* [Sleep for one second when funding locked message is not * [Sleep for 10ms when funding locked message is not
received](https://github.com/lightningnetwork/lnd/pull/7095) to avoid CPU received](https://github.com/lightningnetwork/lnd/pull/7126) to avoid CPU
spike. spike.
## Code Health ## Code Health
+11
View File
@@ -0,0 +1,11 @@
//go:build rpctest
package funding
import "time"
func init() {
// For itest, we will use a much shorter checking interval here as
// local communications are very fast.
checkPeerFundingLockInterval = 10 * time.Millisecond
}
+9 -2
View File
@@ -39,6 +39,13 @@ var (
// byteOrder defines the endian-ness we use for encoding to and from // byteOrder defines the endian-ness we use for encoding to and from
// buffers. // buffers.
byteOrder = binary.BigEndian byteOrder = binary.BigEndian
// checkPeerFundingLockInterval is used when we are waiting for the
// peer to send us FundingLocked. We will check every 1 second to see
// if the message is received.
//
// NOTE: for itest, this value is changed to 10ms.
checkPeerFundingLockInterval = 1 * time.Second
) )
// WriteOutpoint writes an outpoint to an io.Writer. This is not the same as // WriteOutpoint writes an outpoint to an io.Writer. This is not the same as
@@ -1022,9 +1029,9 @@ func (f *Manager) stateStep(channel *channeldb.OpenChannel,
if !received { if !received {
// We haven't received FundingLocked, so we'll continue // We haven't received FundingLocked, so we'll continue
// to the next iteration of the loop after sleeping for // to the next iteration of the loop after sleeping for
// one second. // checkPeerFundingLockInterval.
select { select {
case <-time.After(1 * time.Second): case <-time.After(checkPeerFundingLockInterval):
case <-f.quit: case <-f.quit:
return ErrFundingManagerShuttingDown return ErrFundingManagerShuttingDown
} }
+7
View File
@@ -90,6 +90,13 @@ func openChannelAndAssert(t *harnessTest, net *lntest.NetworkHarness,
"unable to assert channel existence", "unable to assert channel existence",
) )
// They should also notice this channel from topology subscription.
err = alice.WaitForNetworkChannelOpen(fundingChanPoint)
require.NoError(t.t, err)
err = bob.WaitForNetworkChannelOpen(fundingChanPoint)
require.NoError(t.t, err)
return fundingChanPoint return fundingChanPoint
} }
+4
View File
@@ -739,6 +739,10 @@ func testUpdateChannelPolicyForPrivateChannel(net *lntest.NetworkHarness,
) )
defer closeChannelAndAssert(t, net, net.Bob, chanPointBobCarol, false) defer closeChannelAndAssert(t, net, net.Bob, chanPointBobCarol, false)
// Carol should be aware of the channel between Alice and Bob.
err = carol.WaitForNetworkChannelOpen(chanPointAliceBob)
require.NoError(t.t, err)
// Get Bob's funding point. // Get Bob's funding point.
bobChanTXID, err := lnrpc.GetChanPointFundingTxid(chanPointBobCarol) bobChanTXID, err := lnrpc.GetChanPointFundingTxid(chanPointBobCarol)
require.NoError(t.t, err, "unable to get txid") require.NoError(t.t, err, "unable to get txid")