Skip to content

Commit

Permalink
Merge pull request #8 from piotr-iohk/dont-use-p2p
Browse files Browse the repository at this point in the history
Don't use p2p for cardano-node
  • Loading branch information
piotr-iohk authored Apr 4, 2023
2 parents 6f7b665 + 0ae2fdb commit 62a2186
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ Metrics/ModuleLength:

Lint/OrAssignmentToConstant:
Enabled: false

Lint/DuplicateBranch:
Enabled: false
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [0.1.5] - 2023-04-04

## Changed
- don't use p2p for cardano-node (#8)

## [0.1.4] - 2023-03-01

## Added
Expand Down
43 changes: 27 additions & 16 deletions lib/cardano-up/launcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,34 @@ def self.node_up(configuration)
}
}
CardanoUp::Session.create_or_update(session_name, service_details)
if CardanoUp::Utils.win?
# Turn off p2p for Windows
# TODO: remove after https://github.com/input-output-hk/ouroboros-network/issues/3968 released
config_win = CardanoUp::Utils.from_json("#{config_dir}/config.json")
config_win[:EnableP2P] = false
CardanoUp::Utils.to_json("#{config_dir}/config.json", config_win)
topology = {
Producers: [
{
addr: "#{env}-node.world.dev.cardano.org",
port: 30_002,
valency: 2
}
]
}
CardanoUp::Utils.to_json("#{config_dir}/topology.json", topology)

# Turn off p2p in config.json and topology.json
config_json = CardanoUp::Utils.from_json("#{config_dir}/config.json")
config_json[:EnableP2P] = false
CardanoUp::Utils.to_json("#{config_dir}/config.json", config_json)
addr = env == 'mainnet' ? 'relays-new.cardano-mainnet.iohk.io' : "#{env}-node.world.dev.cardano.org"
port = case env
when 'mainnet'
3001
when 'preprod'
30_000
when 'preview'
30_002
else
30_000
end
topology_json = {
Producers: [
{
addr: addr,
port: port,
valency: 2
}
]
}
CardanoUp::Utils.to_json("#{config_dir}/topology.json", topology_json)

if CardanoUp::Utils.win?
# create cardano-node.bat file
File.write("#{bin_dir}/cardano-node.bat", node_cmd)
install_node = "nssm install #{node_service} #{bin_dir}/cardano-node.bat"
Expand Down
2 changes: 1 addition & 1 deletion lib/cardano-up/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

# Version
module CardanoUp
VERSION ||= '0.1.4'
VERSION ||= '0.1.5'
end

0 comments on commit 62a2186

Please sign in to comment.