Skip to content

Commit faf5317

Browse files
committed
bitcoin, scenarios: pull rpc port and auth from chart
1 parent 288f50f commit faf5317

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

resources/charts/bitcoincore/templates/pod.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ metadata:
77
{{- with .Values.podLabels }}
88
{{- toYaml . | nindent 4 }}
99
{{- end }}
10+
chain: {{ .Values.chain }}
11+
RPCPort: "{{ index .Values .Values.chain "RPCPort" }}"
1012
app: {{ include "bitcoincore.fullname" . }}
1113
{{- if .Values.collectLogs }}
1214
collect_logs: "true"

src/warnet/bitcoin.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ def rpc(tank: str, method: str, params: str):
3636

3737

3838
def _rpc(tank: str, method: str, params: str):
39+
# bitcoin-cli should be able to read bitcoin.conf inside the container
40+
# so no extra args like port, chain, username or password are needed
3941
if params:
40-
cmd = f"kubectl exec {tank} -- bitcoin-cli -regtest -rpcuser='user' -rpcpassword='password' {method} {' '.join(map(str, params))}"
42+
cmd = f"kubectl exec {tank} -- bitcoin-cli {method} {' '.join(map(str, params))}"
4143
else:
42-
cmd = f"kubectl exec {tank} -- bitcoin-cli -regtest -rpcuser='user' -rpcpassword='password' {method}"
44+
cmd = f"kubectl exec {tank} -- bitcoin-cli {method}"
4345
return run_command(cmd)
4446

4547

src/warnet/control.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ def run(scenario_file: str, additional_args: tuple[str]):
173173
tanks = [
174174
{
175175
"tank": tank.metadata.name,
176-
"chain": "regtest",
176+
"chain": tank.metadata.labels["chain"],
177177
"rpc_host": tank.status.pod_ip,
178-
"rpc_port": 18443,
178+
"rpc_port": int(tank.metadata.labels["RPCPort"]),
179179
"rpc_user": "user",
180180
"rpc_password": "password",
181181
"init_peers": [],

0 commit comments

Comments
 (0)