rpcserver: add self-node check in OpenChannelSync

This commit is contained in:
Conner Fromknecht committed 2020-03-31 10:21:29 -07:00
1 parent 303d441d4d
commit c1f9c56e5b
1 file changed
+6
+6
View File
@@ -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)