Skip to content

Commit

Permalink
bitcoin: reconcile maxConnections
Browse files Browse the repository at this point in the history
  • Loading branch information
mFarghaly committed Feb 29, 2024
1 parent 757e0d8 commit 45045e8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions clients/bitcoin/bitcoin_core_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func (c *BitcoinCoreClient) Args() (args []string) {

args = append(args, fmt.Sprintf("%s=%s", BitcoinArgDataDir, shared.PathData(c.HomeDir())))
args = append(args, fmt.Sprintf("%s=%d", BitcoinArgListen, Btoi(*node.Spec.Listen)))
args = append(args, fmt.Sprintf("%s=%d", BitcoinArgMaxConnections, *node.Spec.MaxConnections))
args = append(args, fmt.Sprintf("%s=%s", BitcoinArgChain, networks[string(node.Spec.Network)]))
args = append(args, fmt.Sprintf("%s=%s:%d", BitcoinArgBind, shared.Host(true), node.Spec.P2PPort))

Expand Down
3 changes: 3 additions & 0 deletions clients/bitcoin/bitcoin_core_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
var _ = Describe("Bitcoin core client", func() {

listen := false
var maxConnections uint = 123
node := &bitcoinv1alpha1.Node{
ObjectMeta: metav1.ObjectMeta{
Name: "bitcoin-node",
Expand All @@ -18,6 +19,7 @@ var _ = Describe("Bitcoin core client", func() {
Spec: bitcoinv1alpha1.NodeSpec{
Network: "mainnet",
Listen: &listen,
MaxConnections: &maxConnections,
RPC: true,
P2PPort: 8888,
RPCPort: 7777,
Expand Down Expand Up @@ -63,6 +65,7 @@ var _ = Describe("Bitcoin core client", func() {
"-coinstatsindex=1",
"-prune=1",
"-dbcache=2048",
"-maxconnections=123",
}))
})

Expand Down
2 changes: 2 additions & 0 deletions clients/bitcoin/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ const (
BitcoinArgRpcWhitelist = "-rpcwhitelist"
// BitcoinArgDBCacheSize is argument used to set maximum database cache size
BitcoinArgDBCacheSize = "-dbcache"
// BitcoinArgMaxConnections is argument used to set maximum connections to peers
BitcoinArgMaxConnections = "-maxconnections"
)

0 comments on commit 45045e8

Please sign in to comment.