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

@ -87,8 +87,7 @@ type fundingReserveCancelMsg struct {
pendingFundingID uint64
// Buffered, used for optionally synchronization.
err chan error // Buffered
done chan struct{} // Buffered
err chan error // 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...