Skip to content

Commit ca4479c

Browse files
committed
Fix comparison string format
1 parent c90e260 commit ca4479c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

crates/networking/rpc/admin/peers.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ impl From<PeerData> for RpcPeer {
5858
Capability::UnsupportedCapability(_) => {}
5959
}
6060
}
61-
dbg!(peer.node.udp_addr(), peer.node.tcp_addr());
6261
RpcPeer {
6362
caps: peer.supported_capabilities,
6463
enode: peer.node.enode_url(),
@@ -103,7 +102,10 @@ mod tests {
103102
peer.supported_capabilities = vec![Capability::Eth, Capability::Snap];
104103
// The first serialized peer shown in geth's documentation example: https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-admin#admin-peers
105104
// The fields "localAddress", "static", "trusted" and "name" were removed as we do not have the necessary information to show them
106-
let expected_serialized_peer = r#"{ caps : ["eth/68", "snap/1"], enode : "enode://4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052@157.90.35.166:30303", id : "6b36f791352f15eb3ec4f67787074ab8ad9d487e37c4401d383f0561a0a20507", network : { inbound : false, remoteAddress : "157.90.35.166:30303"}, protocols : { eth : { version : 68 }, snap : { version : 1 }}"#.to_string();
105+
// Also the capability versions were removed as we don't currenlty store them in the Capability enum
106+
// We should add them along with https://github.com/lambdaclass/ethrex/issues/1578
107+
// Misc: Added 0x prefix to node id, there is no set spec for this method so the prefix shouldn't be a problem
108+
let expected_serialized_peer = r#"{"caps":["eth","snap"],"enode":"enode://4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052@157.90.35.166:30303","id":"0x6b36f791352f15eb3ec4f67787074ab8ad9d487e37c4401d383f0561a0a20507","network":{"inbound":false,"remoteAddress":"157.90.35.166:30303"},"protocols":{"eth":{"version":68},"snap":{"version":1}}}"#.to_string();
107109
let serialized_peer =
108110
serde_json::to_string(&RpcPeer::from(peer)).expect("Failed to serialize peer");
109111
assert_eq!(serialized_peer, expected_serialized_peer);

0 commit comments

Comments
 (0)