Merge pull request #3634 from halseth/funding-sync-sendmessage

fundingmanager: make SendToPeer sync
This commit is contained in:
Olaoluwa Osuntokun 2019-10-28 17:47:03 -07:00 committed by GitHub
commit c069bdd4c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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())