diff --git a/rpcserver.go b/rpcserver.go index f9753bbbe..5ff15de2f 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -1867,6 +1867,12 @@ func (r *rpcServer) OpenChannelSync(ctx context.Context, } } + // Making a channel to ourselves wouldn't be of any use, so we + // explicitly disallow them. + if nodePubKey.IsEqual(r.server.identityPriv.PubKey()) { + return nil, fmt.Errorf("cannot open channel to self") + } + localFundingAmt := btcutil.Amount(in.LocalFundingAmount) remoteInitialBalance := btcutil.Amount(in.PushSat) minHtlcIn := lnwire.MilliSatoshi(in.MinHtlcMsat)