What changed, and why it matters
This commit fixes the JSON response format of a network information method called server.features. Previously, the software told connecting clients about its TCP port in a malformed way that did not follow the Electrum protocol. The patch now wraps the port under the server's IP address, which is the correct shape. This is a protocol-compliance bug, not an obvious security vulnerability, but non-compliant responses can confuse or break Electrum wallet clients that rely on this data.
Treat as a normal bugfix. Update clients/servers to the patched version to avoid interoperability failures with strict Electrum protocol parsers. No emergency security response is indicated by the commit content.
Security signals we found
Protocol format compliance fix
Client interoperability issue
No input validation or memory-safety change
No authentication, authorization, or cryptography change
Evidence from the diff
The server.features Electrum RPC method was returning hosts as {“tcp_port”:
Changed components
src/electrum.rsserver.features RPC methodElectrum protocol response formattingInspect captured patch +8 / −3
diff --git a/src/electrum.rs b/src/electrum.rs
index fa67b1d..e6ef9c6 100644
--- a/src/electrum.rs
+++ b/src/electrum.rs
@@ -13,6 +13,7 @@ use serde_json::{self, json, Value};
use std::collections::{hash_map::Entry, HashMap};
use std::fmt;
use std::iter::FromIterator;
+use std::net::SocketAddr;
use std::str::FromStr;
use crate::{
@@ -150,7 +151,7 @@ pub struct Rpc {
daemon: Daemon,
signal: Signal,
banner: String,
- port: u16,
+ addr: SocketAddr,
}
impl Rpc {
@@ -174,7 +175,7 @@ impl Rpc {
daemon,
signal,
banner: config.server_banner.clone(),
- port: config.electrum_rpc_addr.port(),
+ addr: config.electrum_rpc_addr,
})
}
@@ -507,7 +508,11 @@ impl Rpc {
fn features(&self) -> Result<Value> {
Ok(json!({
"genesis_hash": self.tracker.chain().get_block_hash(0),
- "hosts": { "tcp_port": self.port },
+ "hosts": {
+ self.addr.ip().to_string(): {
+ "tcp_port": self.addr.port()
+ }
+ },
"protocol_max": PROTOCOL_VERSION,
"protocol_min": PROTOCOL_VERSION,
"pruning": null,
Why this scored 21/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.