peer+server: wait until peer is active to begin channel opening process

Without waiting, we would proceed to retrieve the remote peer's
supported features, which may have not been set due to not yet receiving
their Init message.
This commit is contained in:
Wilmer Paulino committed 2019-10-01 17:42:43 -04:00
1 parent 43b02d3035
commit cf5dc90d04
2 files changed
+21

No files matched your search

+12
View File
@@ -3207,6 +3207,18 @@ func (s *server) OpenChannel(
}
s.mu.RUnlock()
// We'll wait until the peer is active before beginning the channel
// opening process.
select {
case <-peer.activeSignal:
case <-peer.quit:
req.err <- fmt.Errorf("peer %x disconnected", pubKeyBytes)
return req.updates, req.err
case <-s.quit:
req.err <- ErrServerShuttingDown
return req.updates, req.err
}
// If the fee rate wasn't specified, then we'll use a default
// confirmation target.
if req.fundingFeePerKw == 0 {