funding: wait for one sec if funding locked is not received
This commit is contained in:
2 files changed
+13
-1
No files matched your search
@@ -146,6 +146,10 @@ 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
|
||||||
|
received](https://github.com/lightningnetwork/lnd/pull/7095) to avoid CPU
|
||||||
|
spike.
|
||||||
|
|
||||||
## Code Health
|
## Code Health
|
||||||
|
|
||||||
* [test: use `T.TempDir` to create temporary test
|
* [test: use `T.TempDir` to create temporary test
|
||||||
|
|||||||
+9
-1
@@ -1021,7 +1021,14 @@ 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.
|
// to the next iteration of the loop after sleeping for
|
||||||
|
// one second.
|
||||||
|
select {
|
||||||
|
case <-time.After(1 * time.Second):
|
||||||
|
case <-f.quit:
|
||||||
|
return ErrFundingManagerShuttingDown
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2952,6 +2959,7 @@ func (f *Manager) receivedFundingLocked(node *btcec.PublicKey,
|
|||||||
|
|
||||||
// Avoid a tight loop if peer is offline.
|
// Avoid a tight loop if peer is offline.
|
||||||
if _, err := f.waitForPeerOnline(node); err != nil {
|
if _, err := f.waitForPeerOnline(node); err != nil {
|
||||||
|
log.Errorf("Wait for peer online failed: %v", err)
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user