rpcserver: add self-node check in OpenChannelSync

This commit is contained in:
Conner Fromknecht 2020-03-30 15:15:15 -07:00
parent 303d441d4d
commit c1f9c56e5b
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

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