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...
|
// RequestFundingReserveCancellation...
|
||||||
// TODO(roasbeef): also return mutated state?
|
// TODO(roasbeef): also return mutated state?
|
||||||
func (r *ChannelReservation) Cancel() {
|
func (r *ChannelReservation) Cancel() error {
|
||||||
doneChan := make(chan struct{}, 1)
|
errChan := make(chan error, 1)
|
||||||
r.wallet.msgChan <- &fundingReserveCancelMsg{
|
r.wallet.msgChan <- &fundingReserveCancelMsg{
|
||||||
pendingFundingID: r.reservationID,
|
pendingFundingID: r.reservationID,
|
||||||
done: doneChan,
|
err: errChan,
|
||||||
}
|
}
|
||||||
|
|
||||||
<-doneChan
|
return <-errChan
|
||||||
}
|
}
|
||||||
|
|
||||||
// WaitForChannelOpen...
|
// WaitForChannelOpen...
|
||||||
|
@ -87,8 +87,7 @@ type fundingReserveCancelMsg struct {
|
|||||||
pendingFundingID uint64
|
pendingFundingID uint64
|
||||||
|
|
||||||
// Buffered, used for optionally synchronization.
|
// Buffered, used for optionally synchronization.
|
||||||
err chan error // Buffered
|
err chan error // Buffered
|
||||||
done chan struct{} // Buffered
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// addCounterPartySigsMsg...
|
// addCounterPartySigsMsg...
|
||||||
@ -430,7 +429,6 @@ func (l *LightningWallet) handleFundingCancelRequest(req *fundingReserveCancelMs
|
|||||||
if !ok {
|
if !ok {
|
||||||
// TODO(roasbeef): make new error, "unkown funding state" or something
|
// TODO(roasbeef): make new error, "unkown funding state" or something
|
||||||
req.err <- fmt.Errorf("attempted to cancel non-existant funding state")
|
req.err <- fmt.Errorf("attempted to cancel non-existant funding state")
|
||||||
req.done <- struct{}{}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,7 +450,6 @@ func (l *LightningWallet) handleFundingCancelRequest(req *fundingReserveCancelMs
|
|||||||
delete(l.fundingLimbo, req.pendingFundingID)
|
delete(l.fundingLimbo, req.pendingFundingID)
|
||||||
|
|
||||||
req.err <- nil
|
req.err <- nil
|
||||||
req.done <- struct{}{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleFundingCounterPartyFunds...
|
// handleFundingCounterPartyFunds...
|
||||||
|
Loading…
Reference in New Issue
Block a user