From 0cbb759d0a681c603fbda56fe71ff359eb6411b4 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Tue, 27 Feb 2018 18:35:56 +0100 Subject: [PATCH] lnwallet: send ReservationError for invalid/incompatible reservation --- lnwallet/wallet.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lnwallet/wallet.go b/lnwallet/wallet.go index c394ff2d2..5719a1eee 100644 --- a/lnwallet/wallet.go +++ b/lnwallet/wallet.go @@ -479,8 +479,8 @@ func (l *LightningWallet) InitChannelReservation( func (l *LightningWallet) handleFundingReserveRequest(req *initFundingReserveMsg) { // It isn't possible to create a channel with zero funds committed. if req.fundingAmount+req.capacity == 0 { - req.err <- fmt.Errorf("cannot have channel with zero " + - "satoshis funded") + err := ErrZeroCapacity() + req.err <- err req.resp <- nil return } @@ -488,9 +488,9 @@ func (l *LightningWallet) handleFundingReserveRequest(req *initFundingReserveMsg // If the funding request is for a different chain than the one the // wallet is aware of, then we'll reject the request. if !bytes.Equal(l.Cfg.NetParams.GenesisHash[:], req.chainHash[:]) { - req.err <- fmt.Errorf("unable to create channel reservation "+ - "for chain=%v, wallet is on chain=%v", - req.chainHash, l.Cfg.NetParams.GenesisHash) + err := ErrChainMismatch(l.Cfg.NetParams.GenesisHash, + req.chainHash) + req.err <- err req.resp <- nil return }