Merge pull request #774 from halseth/reservation-cancellation
Reservation cancellation during failing funding flow
This commit is contained in:
commit
f815c6ca14
@ -824,11 +824,10 @@ func (f *fundingManager) handleFundingOpen(fmsg *fundingOpenMsg) {
|
|||||||
// synced to the network as we won't be able to properly validate the
|
// synced to the network as we won't be able to properly validate the
|
||||||
// confirmation of the funding transaction.
|
// confirmation of the funding transaction.
|
||||||
isSynced, _, err := f.cfg.Wallet.IsSynced()
|
isSynced, _, err := f.cfg.Wallet.IsSynced()
|
||||||
|
if err != nil || !isSynced {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fndgLog.Errorf("unable to query wallet: %v", err)
|
fndgLog.Errorf("unable to query wallet: %v", err)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
if !isSynced {
|
|
||||||
f.failFundingFlow(
|
f.failFundingFlow(
|
||||||
fmsg.peerAddress.IdentityKey, fmsg.msg.PendingChannelID,
|
fmsg.peerAddress.IdentityKey, fmsg.msg.PendingChannelID,
|
||||||
lnwire.ErrorData{byte(lnwire.ErrSynchronizingChain)},
|
lnwire.ErrorData{byte(lnwire.ErrSynchronizingChain)},
|
||||||
@ -2437,8 +2436,17 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
|
|||||||
ChannelFlags: channelFlags,
|
ChannelFlags: channelFlags,
|
||||||
}
|
}
|
||||||
if err := f.cfg.SendToPeer(peerKey, &fundingOpen); err != nil {
|
if err := f.cfg.SendToPeer(peerKey, &fundingOpen); err != nil {
|
||||||
fndgLog.Errorf("Unable to send funding request message: %v", err)
|
e := fmt.Errorf("Unable to send funding request message: %v",
|
||||||
msg.err <- err
|
err)
|
||||||
|
fndgLog.Errorf(e.Error())
|
||||||
|
|
||||||
|
// Since we were unable to send the initial message to the peer
|
||||||
|
// and start the funding flow, we'll cancel this reservation.
|
||||||
|
if _, err := f.cancelReservationCtx(peerKey, chanID); err != nil {
|
||||||
|
fndgLog.Errorf("unable to cancel reservation: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg.err <- e
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user