From 1823840ed6830d1f30ec86296f7e5ec9bdb605c3 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Mon, 30 Mar 2020 16:55:31 -0700 Subject: [PATCH] rpcserver: add missing channel limit check to OpenChannelSync --- rpcserver.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rpcserver.go b/rpcserver.go index 4b5f56bc..01faa0d3 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -1870,6 +1870,14 @@ func (r *rpcServer) OpenChannelSync(ctx context.Context, "initial state must be below the local funding amount") } + // Ensure that the user doesn't exceed the current soft-limit for + // channel size. If the funding amount is above the soft-limit, then + // we'll reject the request. + if localFundingAmt > MaxFundingAmount { + return nil, fmt.Errorf("funding amount is too large, the max "+ + "channel size is: %v", MaxFundingAmount) + } + // Restrict the size of the channel we'll actually open. At a later // level, we'll ensure that the output we create after accounting for // fees that a dust output isn't created.