mirror of
https://github.com/aljazceru/lspd.git
synced 2025-12-18 14:24:21 +01:00
Retrieve the channel amount and the channel privacy from the environment
This commit is contained in:
13
server.go
13
server.go
@@ -9,6 +9,7 @@ import (
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
lspdrpc "github.com/breez/lspd/rpc"
|
||||
@@ -115,13 +116,21 @@ func (s *server) OpenChannel(ctx context.Context, in *lspdrpc.OpenChannelRequest
|
||||
var txidStr string
|
||||
var outputIndex uint32
|
||||
if len(nodeChannels) == 0 && len(pendingChannels) == 0 {
|
||||
channelAmount, err := strconv.ParseInt(os.Getenv("CHANNEL_AMOUNT"), 0, 64)
|
||||
if err != nil || channelAmount <= 0 {
|
||||
channelAmount = publicChannelAmount
|
||||
}
|
||||
isPrivate, err := strconv.ParseBool(os.Getenv("CHANNEL_PRIVATE"))
|
||||
if err != nil {
|
||||
isPrivate = false
|
||||
}
|
||||
response, err := client.OpenChannelSync(clientCtx, &lnrpc.OpenChannelRequest{
|
||||
LocalFundingAmount: publicChannelAmount,
|
||||
LocalFundingAmount: channelAmount,
|
||||
NodePubkeyString: in.Pubkey,
|
||||
PushSat: 0,
|
||||
TargetConf: targetConf,
|
||||
MinHtlcMsat: minHtlcMsat,
|
||||
Private: false,
|
||||
Private: isPrivate,
|
||||
})
|
||||
log.Printf("Response from OpenChannel: %#v (TX: %v)", response, hex.EncodeToString(response.GetFundingTxidBytes()))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user