mirror of
https://github.com/aljazceru/lspd.git
synced 2025-12-19 14:54:22 +01:00
Ensure that private and public channels have different capacity
This commit is contained in:
@@ -52,6 +52,9 @@ func isConnected(ctx context.Context, client lnrpc.LightningClient, destination
|
|||||||
|
|
||||||
func openChannel(ctx context.Context, client lnrpc.LightningClient, paymentHash, destination []byte, incomingAmountMsat int64) ([]byte, uint32, error) {
|
func openChannel(ctx context.Context, client lnrpc.LightningClient, paymentHash, destination []byte, incomingAmountMsat int64) ([]byte, uint32, error) {
|
||||||
capacity := incomingAmountMsat/1000 + additionalChannelCapacity
|
capacity := incomingAmountMsat/1000 + additionalChannelCapacity
|
||||||
|
if capacity == publicChannelAmount {
|
||||||
|
capacity++
|
||||||
|
}
|
||||||
channelPoint, err := client.OpenChannelSync(ctx, &lnrpc.OpenChannelRequest{
|
channelPoint, err := client.OpenChannelSync(ctx, &lnrpc.OpenChannelRequest{
|
||||||
NodePubkey: destination,
|
NodePubkey: destination,
|
||||||
LocalFundingAmount: capacity,
|
LocalFundingAmount: capacity,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
channelAmount = 1_000_183
|
publicChannelAmount = 1_000_183
|
||||||
targetConf = 6
|
targetConf = 6
|
||||||
minHtlcMsat = 600
|
minHtlcMsat = 600
|
||||||
baseFeeMsat = 1000
|
baseFeeMsat = 1000
|
||||||
@@ -58,7 +58,7 @@ func (s *server) ChannelInformation(ctx context.Context, in *lspdrpc.ChannelInfo
|
|||||||
Name: nodeName,
|
Name: nodeName,
|
||||||
Pubkey: nodePubkey,
|
Pubkey: nodePubkey,
|
||||||
Host: os.Getenv("NODE_HOST"),
|
Host: os.Getenv("NODE_HOST"),
|
||||||
ChannelCapacity: channelAmount,
|
ChannelCapacity: publicChannelAmount,
|
||||||
TargetConf: targetConf,
|
TargetConf: targetConf,
|
||||||
MinHtlcMsat: minHtlcMsat,
|
MinHtlcMsat: minHtlcMsat,
|
||||||
BaseFeeMsat: baseFeeMsat,
|
BaseFeeMsat: baseFeeMsat,
|
||||||
@@ -112,7 +112,7 @@ func (s *server) OpenChannel(ctx context.Context, in *lspdrpc.OpenChannelRequest
|
|||||||
var outputIndex uint32
|
var outputIndex uint32
|
||||||
if len(nodeChannels) == 0 && len(pendingChannels) == 0 {
|
if len(nodeChannels) == 0 && len(pendingChannels) == 0 {
|
||||||
response, err := client.OpenChannelSync(clientCtx, &lnrpc.OpenChannelRequest{
|
response, err := client.OpenChannelSync(clientCtx, &lnrpc.OpenChannelRequest{
|
||||||
LocalFundingAmount: channelAmount,
|
LocalFundingAmount: publicChannelAmount,
|
||||||
NodePubkeyString: in.Pubkey,
|
NodePubkeyString: in.Pubkey,
|
||||||
PushSat: 0,
|
PushSat: 0,
|
||||||
TargetConf: targetConf,
|
TargetConf: targetConf,
|
||||||
|
|||||||
Reference in New Issue
Block a user