diff --git a/resources/charts/bitcoincore/charts/lnd/templates/_helpers.tpl b/resources/charts/bitcoincore/charts/lnd/templates/_helpers.tpl index c7f5ae792..b32edb388 100644 --- a/resources/charts/bitcoincore/charts/lnd/templates/_helpers.tpl +++ b/resources/charts/bitcoincore/charts/lnd/templates/_helpers.tpl @@ -85,3 +85,15 @@ Create a hex-encoded RGB color derived from the namespace {{- printf "#%s" (substr 0 6 $hash) -}} {{- end -}} +{{/* +Data to init wallet with root key if lnd >= v0.16.0-beta +*/}} +{{- define "lnd.initwalletData" -}} +{{- $tag := .Values.image.tag -}} +{{- $supportsRootKey := semverCompare ">=0.16.0-beta" $tag -}} +{{- if $supportsRootKey -}} +"{\"macaroon_root_key\":\"{{ .Values.macaroonRootKey }}\", \"wallet_password\":\"AAAAAAAAAAA=\", \"cipher_seed_mnemonic\": $PHRASE}" +{{- else -}} +"{\"wallet_password\":\"AAAAAAAAAAA=\", \"cipher_seed_mnemonic\": $PHRASE}" +{{- end -}} +{{- end -}} diff --git a/resources/charts/bitcoincore/charts/lnd/templates/pod.yaml b/resources/charts/bitcoincore/charts/lnd/templates/pod.yaml index c8cbb2441..ae48728a4 100644 --- a/resources/charts/bitcoincore/charts/lnd/templates/pod.yaml +++ b/resources/charts/bitcoincore/charts/lnd/templates/pod.yaml @@ -69,7 +69,7 @@ spec: PHRASE=$(cat /tmp/genseed.json | grep -o '\[[^]]*\]') - until curl --fail --insecure https://localhost:8080/v1/initwallet --data "{\"macaroon_root_key\":\"{{ .Values.macaroonRootKey }}\", \"wallet_password\":\"AAAAAAAAAAA=\", \"cipher_seed_mnemonic\": $PHRASE}"; do + until curl --fail --insecure https://localhost:8080/v1/initwallet --data {{ include "lnd.initwalletData" . }}; do sleep 5 done resources: