wallet/reservation: Cancel needs to return an error
This commit is contained in:
parent
354bc74d3c
commit
24efbb46c3
@ -117,14 +117,14 @@ func (r *ChannelReservation) FinalFundingTx() *btcutil.Tx {
|
||||
|
||||
// RequestFundingReserveCancellation...
|
||||
// TODO(roasbeef): also return mutated state?
|
||||
func (r *ChannelReservation) Cancel() {
|
||||
doneChan := make(chan struct{}, 1)
|
||||
func (r *ChannelReservation) Cancel() error {
|
||||
errChan := make(chan error, 1)
|
||||
r.wallet.msgChan <- &fundingReserveCancelMsg{
|
||||
pendingFundingID: r.reservationID,
|
||||
done: doneChan,
|
||||
err: errChan,
|
||||
}
|
||||
|
||||
<-doneChan
|
||||
return <-errChan
|
||||
}
|
||||
|
||||
// WaitForChannelOpen...
|
||||
|
@ -88,7 +88,6 @@ type fundingReserveCancelMsg struct {
|
||||
|
||||
// Buffered, used for optionally synchronization.
|
||||
err chan error // Buffered
|
||||
done chan struct{} // Buffered
|
||||
}
|
||||
|
||||
// addCounterPartySigsMsg...
|
||||
@ -430,7 +429,6 @@ func (l *LightningWallet) handleFundingCancelRequest(req *fundingReserveCancelMs
|
||||
if !ok {
|
||||
// TODO(roasbeef): make new error, "unkown funding state" or something
|
||||
req.err <- fmt.Errorf("attempted to cancel non-existant funding state")
|
||||
req.done <- struct{}{}
|
||||
return
|
||||
}
|
||||
|
||||
@ -452,7 +450,6 @@ func (l *LightningWallet) handleFundingCancelRequest(req *fundingReserveCancelMs
|
||||
delete(l.fundingLimbo, req.pendingFundingID)
|
||||
|
||||
req.err <- nil
|
||||
req.done <- struct{}{}
|
||||
}
|
||||
|
||||
// handleFundingCounterPartyFunds...
|
||||
|
Loading…
Reference in New Issue
Block a user