diff --git a/funding/config_rpctest.go b/funding/config_rpctest.go new file mode 100644 index 000000000..44a2c939c --- /dev/null +++ b/funding/config_rpctest.go @@ -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 +} diff --git a/funding/manager.go b/funding/manager.go index d5e6e730e..1130b076a 100644 --- a/funding/manager.go +++ b/funding/manager.go @@ -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 }