Skip to content

Commit

Permalink
tanks: use addnode instead of connect
Browse files Browse the repository at this point in the history
This should help with addr gossip
  • Loading branch information
willcl-ark committed Oct 9, 2024
1 parent 5773805 commit a0c42ef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions resources/charts/bitcoincore/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ data:
zmqpubrawtx=tcp://0.0.0.0:{{ .Values.ZMQTxPort }}
{{- .Values.defaultConfig | nindent 4 }}
{{- .Values.config | nindent 4 }}
{{- range .Values.connect }}
{{- print "connect=" . | nindent 4}}
{{- end }}
{{- range .Values.addnode }}
{{- print "addnode=" . | nindent 4}}
{{- end }}
2 changes: 1 addition & 1 deletion resources/charts/bitcoincore/templates/pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ metadata:
collect_logs: "true"
{{- end }}
annotations:
init_peers: "{{ .Values.connect | len }}"
init_peers: "{{ .Values.addnode | len }}"
spec:
restartPolicy: "{{ .Values.restartPolicy }}"
{{- with .Values.imagePullSecrets }}
Expand Down
2 changes: 1 addition & 1 deletion resources/charts/bitcoincore/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ config: ""

defaultConfig: ""

connect: []
addnode: []
loadSnapshot:
enabled: false
url: ""
6 changes: 3 additions & 3 deletions src/warnet/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ def custom_graph(
connections = set()

for i in range(num_nodes):
node = {"name": f"tank-{i:04d}", "connect": [], "image": {"tag": version}}
node = {"name": f"tank-{i:04d}", "addnode": [], "image": {"tag": version}}

# Add round-robin connection
next_node = (i + 1) % num_nodes
node["connect"].append(f"tank-{next_node:04d}")
node["addnode"].append(f"tank-{next_node:04d}")
connections.add((i, next_node))

# Add random connections
Expand All @@ -55,7 +55,7 @@ def custom_graph(
random_node = random.choice(available_nodes)
# Avoid circular loops of A -> B -> A
if (random_node, i) not in connections:
node["connect"].append(f"tank-{random_node:04d}")
node["addnode"].append(f"tank-{random_node:04d}")
connections.add((i, random_node))
available_nodes.remove(random_node)

Expand Down

0 comments on commit a0c42ef

Please sign in to comment.