wallet/reservation: Cancel needs to return an error

This commit is contained in:
Olaoluwa Osuntokun 2015-12-16 14:40:44 -06:00
parent 354bc74d3c
commit 24efbb46c3
2 changed files with 5 additions and 8 deletions

@ -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...

@ -88,7 +88,6 @@ type fundingReserveCancelMsg struct {
// 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...