funding: during funding error fail before sending Error to peer
In this commit, we modify the logic executed when we decide that we need to fail a funding flow. Before this commit, if the remote party disconnected while we were attempting to fail the funding flow with an error. Then we'd never actually cancel the reservation. This meant that any inputs selected for that transaction would be locked until a restart. We fix this issue by always cancelling the reservation first, and ensuring that failure to cancel the reservation doesn't prevent us from sending the error. Partially addresses #710.
This commit is contained in:
parent
b4e280eb15
commit
c823aeafab
@ -676,13 +676,16 @@ func (f *fundingManager) failFundingFlow(peer *btcec.PublicKey,
|
|||||||
|
|
||||||
fndgLog.Errorf("Failing funding flow: %v", spew.Sdump(errMsg))
|
fndgLog.Errorf("Failing funding flow: %v", spew.Sdump(errMsg))
|
||||||
|
|
||||||
|
if _, err := f.cancelReservationCtx(peer, tempChanID); err != nil {
|
||||||
|
fndgLog.Errorf("unable to cancel reservation: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
err := f.cfg.SendToPeer(peer, errMsg)
|
err := f.cfg.SendToPeer(peer, errMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fndgLog.Errorf("unable to send error message to peer %v", err)
|
fndgLog.Errorf("unable to send error message to peer %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
f.cancelReservationCtx(peer, tempChanID)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user