fundingmanager: make SendToPeer sync
Since the funding flow requires messages to go through, make use of sync version of SendToPeer. Using the async version we would risk that the message was dropped and the process would stall (it would properly continue after a restart though).
This commit is contained in:
parent
018737a80a
commit
12a1d05127
@ -1353,7 +1353,7 @@ func (f *fundingManager) handleFundingOpen(fmsg *fundingOpenMsg) {
|
|||||||
HtlcPoint: ourContribution.HtlcBasePoint.PubKey,
|
HtlcPoint: ourContribution.HtlcBasePoint.PubKey,
|
||||||
FirstCommitmentPoint: ourContribution.FirstCommitmentPoint,
|
FirstCommitmentPoint: ourContribution.FirstCommitmentPoint,
|
||||||
}
|
}
|
||||||
if err := fmsg.peer.SendMessage(false, &fundingAccept); err != nil {
|
if err := fmsg.peer.SendMessage(true, &fundingAccept); err != nil {
|
||||||
fndgLog.Errorf("unable to send funding response to peer: %v", err)
|
fndgLog.Errorf("unable to send funding response to peer: %v", err)
|
||||||
f.failFundingFlow(fmsg.peer, msg.PendingChannelID, err)
|
f.failFundingFlow(fmsg.peer, msg.PendingChannelID, err)
|
||||||
return
|
return
|
||||||
@ -1512,7 +1512,7 @@ func (f *fundingManager) handleFundingAccept(fmsg *fundingAcceptMsg) {
|
|||||||
f.failFundingFlow(fmsg.peer, msg.PendingChannelID, err)
|
f.failFundingFlow(fmsg.peer, msg.PendingChannelID, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := fmsg.peer.SendMessage(false, fundingCreated); err != nil {
|
if err := fmsg.peer.SendMessage(true, fundingCreated); err != nil {
|
||||||
fndgLog.Errorf("Unable to send funding complete message: %v", err)
|
fndgLog.Errorf("Unable to send funding complete message: %v", err)
|
||||||
f.failFundingFlow(fmsg.peer, msg.PendingChannelID, err)
|
f.failFundingFlow(fmsg.peer, msg.PendingChannelID, err)
|
||||||
return
|
return
|
||||||
@ -1625,7 +1625,7 @@ func (f *fundingManager) handleFundingCreated(fmsg *fundingCreatedMsg) {
|
|||||||
ChanID: channelID,
|
ChanID: channelID,
|
||||||
CommitSig: ourCommitSig,
|
CommitSig: ourCommitSig,
|
||||||
}
|
}
|
||||||
if err := fmsg.peer.SendMessage(false, fundingSigned); err != nil {
|
if err := fmsg.peer.SendMessage(true, fundingSigned); err != nil {
|
||||||
fndgLog.Errorf("unable to send FundingSigned message: %v", err)
|
fndgLog.Errorf("unable to send FundingSigned message: %v", err)
|
||||||
f.failFundingFlow(fmsg.peer, pendingChanID, err)
|
f.failFundingFlow(fmsg.peer, pendingChanID, err)
|
||||||
deleteFromDatabase()
|
deleteFromDatabase()
|
||||||
@ -2133,7 +2133,7 @@ func (f *fundingManager) sendFundingLocked(
|
|||||||
fndgLog.Infof("Peer(%x) is online, sending FundingLocked "+
|
fndgLog.Infof("Peer(%x) is online, sending FundingLocked "+
|
||||||
"for ChannelID(%v)", peerKey, chanID)
|
"for ChannelID(%v)", peerKey, chanID)
|
||||||
|
|
||||||
if err := peer.SendMessage(false, fundingLockedMsg); err == nil {
|
if err := peer.SendMessage(true, fundingLockedMsg); err == nil {
|
||||||
// Sending succeeded, we can break out and continue the
|
// Sending succeeded, we can break out and continue the
|
||||||
// funding flow.
|
// funding flow.
|
||||||
break
|
break
|
||||||
@ -2890,7 +2890,7 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
|
|||||||
FirstCommitmentPoint: ourContribution.FirstCommitmentPoint,
|
FirstCommitmentPoint: ourContribution.FirstCommitmentPoint,
|
||||||
ChannelFlags: channelFlags,
|
ChannelFlags: channelFlags,
|
||||||
}
|
}
|
||||||
if err := msg.peer.SendMessage(false, &fundingOpen); err != nil {
|
if err := msg.peer.SendMessage(true, &fundingOpen); err != nil {
|
||||||
e := fmt.Errorf("Unable to send funding request message: %v",
|
e := fmt.Errorf("Unable to send funding request message: %v",
|
||||||
err)
|
err)
|
||||||
fndgLog.Errorf(e.Error())
|
fndgLog.Errorf(e.Error())
|
||||||
|
Loading…
Reference in New Issue
Block a user