mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 06:21:40 +01:00
funding: decrease checking interval to be 10ms in itest
When waiting for the peer to send us FundingLocked, we check whether we've received this message periodically. This commit changes the checking interval from 1s to 10ms in itest, which allows us to still stop the CPU spike while responding to the message quickly.
This commit is contained in:
parent
22fec76339
commit
4b558c3af5
2 changed files with 20 additions and 2 deletions
11
funding/config_rpctest.go
Normal file
11
funding/config_rpctest.go
Normal 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
|
||||
}
|
|
@ -39,6 +39,13 @@ var (
|
|||
// byteOrder defines the endian-ness we use for encoding to and from
|
||||
// buffers.
|
||||
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
|
||||
|
@ -1022,9 +1029,9 @@ func (f *Manager) stateStep(channel *channeldb.OpenChannel,
|
|||
if !received {
|
||||
// We haven't received FundingLocked, so we'll continue
|
||||
// to the next iteration of the loop after sleeping for
|
||||
// one second.
|
||||
// checkPeerFundingLockInterval.
|
||||
select {
|
||||
case <-time.After(1 * time.Second):
|
||||
case <-time.After(checkPeerFundingLockInterval):
|
||||
case <-f.quit:
|
||||
return ErrFundingManagerShuttingDown
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue