turn the server toggle off and retry when the ping finds the server connection closed
What changed, and why it matters
This tiny change alters what happens when Sparrow Wallet's background ping notices the connection to an Electrum server has dropped. Previously the code simply closed the local connection. Now it throws an explicit 'connection lost' error, which the surrounding logic is designed to catch, flip the server toggle off, and retry. The intent appears to be a reliability fix: make the wallet recover automatically from a dropped server connection rather than silently staying in a broken state.
Review the surrounding exception-handling path to confirm the thrown ServerException is caught and correctly toggles the server off and retries, without leaking resources or entering an infinite retry loop. Treat as a reliability improvement unless further review shows it introduces a denial-of-service or state confusion issue.
Security signals we found
Changes connection-lost handling from silent close to explicit exception
May affect how the wallet behaves when the Electrum server drops mid-operation
Potential for state-machine change in network connection handling
Evidence from the diff
In ElectrumServer.java, inside the fee-rates update task, the else branch that handles a closed server connection was changed from closeConnection() to throw new ServerException("Connection to server lost"). The commit title indicates the thrown exception triggers higher-level logic to turn the server toggle off and retry. This is a one-line behavioral change from silent cleanup to explicit failure signaling so the connection state machine can recover.
Changed components
src/main/java/com/sparrowwallet/sparrow/net/ElectrumServer.javaFee rate update task / server ping logicInspect captured patch +1 / −1
### src/main/java/com/sparrowwallet/sparrow/net/ElectrumServer.java
@@ -3230,7 +3230,7 @@ protected FeeRatesUpdatedEvent call() throws ServerException {
return new FeeRatesUpdatedEvent(blockTargetFeeRates, mempoolRateSizes, nextBlockMedianFeeRate);
}
} else {
- closeConnection();
+ throw new ServerException("Connection to server lost");
}
}
Why this scored 25/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.