Skip to content

Commit

Permalink
server: make all connections with addnode
Browse files Browse the repository at this point in the history
using `addpeeraddress` sounds better, but it does not guarantee that all
nodes have connections made to them in the end. This causes issues on
large graphs.

Remove this behaviour.
  • Loading branch information
willcl-ark committed Feb 22, 2024
1 parent bff4e67 commit 0b1fb87
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/warnet/warnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from backends import ComposeBackend, KubernetesBackend
from templates import TEMPLATES
from warnet.tank import Tank
from warnet.utils import gen_config_dir, version_cmp_ge
from warnet.utils import gen_config_dir

logger = logging.getLogger("warnet")
FO_CONF_NAME = "fork_observer_config.toml"
Expand Down Expand Up @@ -172,14 +172,8 @@ def connect_edges(self):
continue
src_tank = self.tanks[src]
dst_ip = self.tanks[dst].ipv4
# <= 20.2 doesn't have addpeeraddress
res = version_cmp_ge(src_tank.version, "0.21.0")
if res:
cmd = f"bitcoin-cli -regtest -rpcuser={src_tank.rpc_user} -rpcpassword={src_tank.rpc_password} addpeeraddress {dst_ip} 18444"
logger.info(f"Using `{cmd}` to connect tanks {src} to {dst}")
else:
cmd = f'bitcoin-cli -regtest -rpcuser={src_tank.rpc_user} -rpcpassword={src_tank.rpc_password} addnode "{dst_ip}:18444" onetry'
logger.info(f"Using `{cmd}` to connect tanks {src} to {dst}")
cmd = f"bitcoin-cli -regtest -rpcuser={src_tank.rpc_user} -rpcpassword={src_tank.rpc_password} addnode {dst_ip}:18444 onetry"
logger.info(f"Using `{cmd}` to connect tanks {src} to {dst}")
src_tank.exec(cmd=cmd)

def warnet_build(self):
Expand Down

0 comments on commit 0b1fb87

Please sign in to comment.