Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Firo peers #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions contrib/systemd/electrumx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,18 @@ DAEMON_URL = http://username:password@hostname:port/

# COIN = Bitcoin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add explicit COIN setting for Firo

The commented out COIN = Bitcoin setting needs to be updated for Firo. This might be causing the peer validation issues reported in the logs.

Apply this change:

-# COIN = Bitcoin
+COIN = Firo
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# COIN = Bitcoin
COIN = Firo


# Peer Configuration
PEER_HOST = electrumx01.firo.org
SERVICES = ssl://electrumx01.firo.org:50002, tcp://electrumx01.firo.org:50001

PEER_HOST = electrumx02.firo.org
SERVICES = ssl://electrumx02.firo.org:50002, tcp://electrumx02.firo.org:50001

PEER_HOST = electrumx03.firo.org
SERVICES = ssl://electrumx03.firo.org:50002, tcp://electrumx03.firo.org:50001

PEER_HOST = electrumx.firo.org
SERVICES = ssl://electrumx.firo.org:50002, tcp://electrumx.firo.org:50001
Comment on lines +11 to +21
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Based on the code analysis, I can now provide the final response:

Multiple PEER_HOST entries are not supported - use REPORT_SERVICES instead

The codebase shows that PEER_HOST is actually obsolete. The configuration should use REPORT_SERVICES for peer announcement. The current configuration format is incorrect because:

  1. The code explicitly marks PEER_HOST as obsolete in Env.__init__: self.obsolete(["MAX_SUBSCRIPTIONS", "MAX_SUBS", "MAX_SESSION_SUBS", "BANDWIDTH_LIMIT", "HOST", "TCP_PORT", "SSL_PORT", "RPC_HOST", "RPC_PORT", "REPORT_HOST"...])
  2. The proper way to configure services is through the SERVICES and REPORT_SERVICES settings, as shown in the Env class implementation.

Correct configuration should look like:

SERVICES = ssl://0.0.0.0:50002,tcp://0.0.0.0:50001
REPORT_SERVICES = ssl://electrumx01.firo.org:50002,tcp://electrumx01.firo.org:50001,ssl://electrumx02.firo.org:50002,tcp://electrumx02.firo.org:50001,ssl://electrumx03.firo.org:50002,tcp://electrumx03.firo.org:50001,ssl://electrumx.firo.org:50002,tcp://electrumx.firo.org:50001
🔗 Analysis chain

Verify peer configuration format and DNS resolution

  1. Multiple PEER_HOST entries might conflict. ElectrumX typically expects a single PEER_HOST setting. Consider using a comma-separated list or REPORT_HOST instead.
  2. Let's verify the DNS resolution for these peers:

Consider consolidating the peer configurations into a single REPORT_HOST setting or using environment-specific configuration files to avoid potential conflicts.


Let me gather more information about the configuration format by checking the ElectrumX codebase for how PEER_HOST is handled.


Let me check the actual configuration handling code to understand how PEER_HOST is processed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify DNS resolution and TCP/SSL port accessibility for the new peers

echo "Checking DNS resolution for peer hosts..."
for host in electrumx01.firo.org electrumx02.firo.org electrumx03.firo.org electrumx.firo.org; do
    echo "Resolving $host..."
    host $host
done

# Search for any existing peer configurations in the codebase
echo -e "\nChecking for existing peer configurations..."
rg -l "PEER_HOST|REPORT_HOST" --type conf

# Check if these hosts are already defined in coins.py
echo -e "\nVerifying peer definitions in coins.py..."
rg "firo.org" --type py

Length of output: 1805


Script:

#!/bin/bash
# Search for PEER_HOST handling in the codebase
echo "Checking PEER_HOST handling in the code..."
rg "PEER_HOST" -A 5 --type py

# Check for any documentation or examples about peer configuration
echo -e "\nChecking for configuration documentation..."
fd README -t f -X cat {}

Length of output: 1369


Script:

#!/bin/bash
# Search for configuration handling in the server setup
echo "Checking server configuration handling..."
ast-grep --pattern 'class Env {
  $$$
}'

# Look for specific configuration parsing
echo -e "\nChecking configuration parsing..."
rg -l "class.*Env" --type py | xargs cat

# Check for any sample configuration files
echo -e "\nChecking sample configurations..."
fd -e conf -e cfg -e sample -X cat {}

Length of output: 11986


# See http://electrumx.readthedocs.io/en/latest/environment.html for
# information about other configuration settings you probably want to consider.
5 changes: 4 additions & 1 deletion electrumx/lib/coins.py
Original file line number Diff line number Diff line change
Expand Up @@ -2536,7 +2536,10 @@ class Firo(Coin):
DAEMON = daemon.FiroMtpDaemon
DESERIALIZER = lib_tx_dash.DeserializerFiro
PEERS = [
'electrum.polispay.com'
'electrumx01.firo.org s t',
'electrumx02.firo.org s t',
'electrumx03.firo.org s t',
'electrumx.firo.org s t',
]
PROGPOW_START_TIME = 1635228000

Expand Down