Skip to content

Commit 814793c

Browse files
committed
checkpoint cln integrated into ln_framework
issues: - restoring wallet produces same spend address on two nodes - lnd node connecting to cln produces infinite reconnect issue - system resource issue - two cln nodes can not find each other - gossip error
1 parent 02609bc commit 814793c

File tree

12 files changed

+289
-63
lines changed

12 files changed

+289
-63
lines changed

resources/charts/bitcoincore/charts/cln/templates/configmap.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,36 @@ data:
1010
{{- .Values.defaultConfig | nindent 4 }}
1111
{{- .Values.config | nindent 4 }}
1212
network={{ .Values.global.chain }}
13+
bind-addr=0.0.0.0:{{ .Values.P2PPort }}
14+
clnrest-port={{ .Values.RestPort }}
1315
bitcoin-rpcconnect={{ include "bitcoincore.fullname" . }}
1416
bitcoin-rpcport={{ index .Values.global .Values.global.chain "RPCPort" }}
1517
bitcoin-rpcpassword={{ .Values.global.rpcpassword }}
1618
alias={{ include "cln.fullname" . }}
19+
announce-addr=dns:{{ include "cln.fullname" . }}:9735
20+
database-upgrade=true
21+
bitcoin-retry-timeout=600
22+
clnrest-certs=/root/.lightning
23+
tls.cert: |
24+
-----BEGIN CERTIFICATE-----
25+
MIIB8TCCAZagAwIBAgIUJDsR6mmY+TaO9pCfjtotlbOkzJMwCgYIKoZIzj0EAwIw
26+
MjEfMB0GA1UECgwWbG5kIGF1dG9nZW5lcmF0ZWQgY2VydDEPMA0GA1UEAwwGd2Fy
27+
bmV0MB4XDTI0MTExMTE2NTM1MFoXDTM0MTEwOTE2NTM1MFowMjEfMB0GA1UECgwW
28+
bG5kIGF1dG9nZW5lcmF0ZWQgY2VydDEPMA0GA1UEAwwGd2FybmV0MFkwEwYHKoZI
29+
zj0CAQYIKoZIzj0DAQcDQgAEBVltIvaTlAQI/3FFatTqVflZuZdRJ0SmRMSJrFLP
30+
tp0fxE7hmteSt6gjQriy90fP8j9OJXBNAjt915kLY4zVvqOBiTCBhjAOBgNVHQ8B
31+
Af8EBAMCAqQwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDwYDVR0TAQH/BAUwAwEB/zAd
32+
BgNVHQ4EFgQU5d8QMrwhLgTkDjWA+eXZGz+dybUwLwYDVR0RBCgwJoIJbG9jYWxo
33+
b3N0ggEqhwR/AAABhxAAAAAAAAAAAAAAAAAAAAABMAoGCCqGSM49BAMCA0kAMEYC
34+
IQDPofN0fEl5gTwCYhk3nZbjMqJhZ8BsSJ6K8XRhxr7zbwIhAPsgQCFOqUWg632O
35+
NEO53OQ6CIqnpxSskjsFNH4ZBQOE
36+
-----END CERTIFICATE-----
37+
tls.key: |
38+
-----BEGIN EC PRIVATE KEY-----
39+
MHcCAQEEIIcFtWTLQv5JaRRxdkPKkO98OrvgeztbZ7h8Ev/4UbE4oAoGCCqGSM49
40+
AwEHoUQDQgAEBVltIvaTlAQI/3FFatTqVflZuZdRJ0SmRMSJrFLPtp0fxE7hmteS
41+
t6gjQriy90fP8j9OJXBNAjt915kLY4zVvg==
42+
-----END EC PRIVATE KEY-----
1743
---
1844
apiVersion: v1
1945
kind: ConfigMap

resources/charts/bitcoincore/charts/cln/templates/pod.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,19 @@ spec:
3131
- name: p2p
3232
containerPort: {{ .Values.P2PPort }}
3333
protocol: TCP
34+
- name: rest
35+
containerPort: {{ .Values.RestPort }}
36+
protocol: TCP
3437
command:
35-
- "lightningd"
36-
- "--conf=/root/.lightning/config"
38+
- /bin/sh
39+
- -c
40+
- |
41+
lightningd --conf=/root/.lightning/config --recover=35b8182d6db5cec40d9bead20607b7c9b91ed89997a290bc0e0f07e5922e4714 &
42+
pid=$!;
43+
sleep 10;
44+
kill $pid;
45+
sleep 1;
46+
lightningd --conf=/root/.lightning/config
3747
livenessProbe:
3848
{{- toYaml .Values.livenessProbe | nindent 8 }}
3949
readinessProbe:
@@ -49,6 +59,12 @@ spec:
4959
- mountPath: /root/.lightning/config
5060
name: config
5161
subPath: config
62+
- mountPath: /root/.lightning/cert
63+
name: config
64+
subPath: tls.cert
65+
- mountPath: /root/.lightning/key
66+
name: config
67+
subPath: tls.key
5268
{{- with .Values.extraContainers }}
5369
{{- toYaml . | nindent 4 }}
5470
{{- end }}

resources/charts/bitcoincore/charts/cln/templates/service.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,9 @@ spec:
1212
targetPort: p2p
1313
protocol: TCP
1414
name: p2p
15+
- port: {{ .Values.RestPort }}
16+
targetPort: rest
17+
protocol: TCP
18+
name: rest
1519
selector:
1620
{{- include "cln.selectorLabels" . | nindent 4 }}

resources/charts/bitcoincore/charts/cln/values.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
# Declare variables to be passed into your templates.
44
namespace: warnet
55

6-
# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
7-
replicaCount: 1
8-
96
image:
107
repository: elementsproject/lightningd
118
pullPolicy: IfNotPresent
@@ -35,6 +32,7 @@ service:
3532
type: ClusterIP
3633

3734
P2PPort: 9735
35+
RestPort: 3010
3836

3937
# This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/
4038
ingress:
@@ -89,10 +87,6 @@ readinessProbe:
8987

9088
# Additional volumes on the output Deployment definition.
9189
volumes: []
92-
# - name: foo
93-
# secret:
94-
# secretName: mysecret
95-
# optional: false
9690

9791
# Additional volumeMounts on the output Deployment definition.
9892
volumeMounts: []
@@ -108,8 +102,10 @@ affinity: {}
108102

109103
baseConfig: |
110104
log-level=debug
111-
bind-addr=0.0.0.0:9735
105+
developer
106+
dev-fast-gossip
112107
bitcoin-rpcuser=user
108+
clnrest-host=0.0.0.0
113109
# bitcoind.rpcpass are set in configmap.yaml
114110
115111
config: ""

resources/charts/bitcoincore/charts/lnd/templates/_helpers.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ If release name contains chart name it will be used as a full name.
2323
Expand the name of the chart.
2424
*/}}
2525
{{- define "lnd.name" -}}
26-
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}-ln
26+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}-lnd
2727
{{- end }}
2828

2929
{{/*
@@ -35,7 +35,7 @@ If release name contains chart name it will be used as a full name.
3535
{{- if .Values.fullnameOverride }}
3636
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
3737
{{- else }}
38-
{{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" }}-ln
38+
{{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" }}-lnd
3939
{{- end }}
4040
{{- end }}
4141

resources/scenarios/commander.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from typing import Dict
1515

1616
from kubernetes import client, config
17-
from ln_framework.ln import LND
17+
from ln_framework.ln import CLN, LND, LNNode
1818
from test_framework.authproxy import AuthServiceProxy
1919
from test_framework.p2p import NetworkThread
2020
from test_framework.test_framework import (
@@ -161,7 +161,7 @@ def setup(self):
161161

162162
# Keep a separate index of tanks by pod name
163163
self.tanks: Dict[str, TestNode] = {}
164-
self.lns: Dict[str, LND] = {}
164+
self.lns: Dict[str, LNNode] = {}
165165
self.channels = WARNET["channels"]
166166

167167
for i, tank in enumerate(WARNET["tanks"]):
@@ -194,7 +194,11 @@ def setup(self):
194194
self.tanks[tank["tank"]] = node
195195

196196
for ln in WARNET["lightning"]:
197-
self.lns[ln] = LND(ln)
197+
#create the correct implementation based on pod name
198+
if "-cln" in ln:
199+
self.lns[ln] = CLN(ln)
200+
else:
201+
self.lns[ln] = LND(ln)
198202

199203
self.num_nodes = len(self.nodes)
200204

0 commit comments

Comments
 (0)