Description
CometNet can permanently lose its persisted statistics after a restart when
one of the persisted PEX peers has an invalid/unusable WebSocket address.
In my case, the persisted peer was:
wss://comet2.042575.xyz/cometnet/ws
The peer was stored with:
source: pex
On restart, CometNet reports:
Failed to load CometNet state:
persisted peer address is invalid:
wss://comet2.042575.xyz/cometnet/ws
When this happens, the entire persisted CometNet state is rejected and CometNet
starts with fresh runtime statistics.
This caused my node's counters to reset from:
torrents_propagated: 125,917,242
to approximately:
torrents_propagated: 500,000
and later even lower after subsequent restarts.
Important details
The persistent state file itself is valid and contains the historical statistics.
The node identity is also unchanged:
Node ID: dbc091d5
The persistent data directory is:
/app/data/cometnet
The problematic peer is a PEX-discovered peer.
I manually removed only that peer from discovery.known_peers and regenerated
the state integrity signature using the existing node private key. After doing
that, CometNet successfully loaded the state and restored the 125,917,242
propagated counter.
Startup then showed:
Loaded reputation data for 173 peers
CometNet started - Node ID: dbc091d5
with no "Failed to load CometNet state" error.
However, the invalid peer was subsequently rediscovered through PEX, so the
problem can recur on a future restart.
Expected behavior
An invalid persisted peer should not cause the entire CometNet state to be
discarded.
Ideally CometNet should:
- Load the valid persisted state.
- Skip/remove the invalid peer.
- Continue loading the remaining peers, reputation, pools, and statistics.
- Save the cleaned state with a new valid integrity signature.
Alternatively, invalid peers could be rejected before they are persisted.
Actual behavior
One invalid PEX peer causes the entire persisted state load to fail:
Failed to load CometNet state:
persisted peer address is invalid: ...
CometNet then starts with fresh counters.
This makes a single bad PEX peer capable of resetting persistent CometNet
statistics after a normal Docker restart.
Environment
Comet Docker deployment
Persistent /app/data/cometnet bind mount
COMETNET_CONTRIBUTION_MODE=full
COMETNET_ALLOW_PRIVATE_PEX=true
The issue reproduces across normal scheduled Docker restarts.
Description
CometNet can permanently lose its persisted statistics after a restart when
one of the persisted PEX peers has an invalid/unusable WebSocket address.
In my case, the persisted peer was:
wss://comet2.042575.xyz/cometnet/ws
The peer was stored with:
source: pex
On restart, CometNet reports:
Failed to load CometNet state:
persisted peer address is invalid:
wss://comet2.042575.xyz/cometnet/ws
When this happens, the entire persisted CometNet state is rejected and CometNet
starts with fresh runtime statistics.
This caused my node's counters to reset from:
torrents_propagated: 125,917,242
to approximately:
torrents_propagated: 500,000
and later even lower after subsequent restarts.
Important details
The persistent state file itself is valid and contains the historical statistics.
The node identity is also unchanged:
Node ID: dbc091d5
The persistent data directory is:
/app/data/cometnet
The problematic peer is a PEX-discovered peer.
I manually removed only that peer from discovery.known_peers and regenerated
the state integrity signature using the existing node private key. After doing
that, CometNet successfully loaded the state and restored the 125,917,242
propagated counter.
Startup then showed:
Loaded reputation data for 173 peers
CometNet started - Node ID: dbc091d5
with no "Failed to load CometNet state" error.
However, the invalid peer was subsequently rediscovered through PEX, so the
problem can recur on a future restart.
Expected behavior
An invalid persisted peer should not cause the entire CometNet state to be
discarded.
Ideally CometNet should:
Alternatively, invalid peers could be rejected before they are persisted.
Actual behavior
One invalid PEX peer causes the entire persisted state load to fail:
Failed to load CometNet state:
persisted peer address is invalid: ...
CometNet then starts with fresh counters.
This makes a single bad PEX peer capable of resetting persistent CometNet
statistics after a normal Docker restart.
Environment
Comet Docker deployment
Persistent /app/data/cometnet bind mount
COMETNET_CONTRIBUTION_MODE=full
COMETNET_ALLOW_PRIVATE_PEX=true
The issue reproduces across normal scheduled Docker restarts.