diff --git a/binaries/cuprated/src/rpc/request/address_book.rs b/binaries/cuprated/src/rpc/request/address_book.rs index 3bde5c6..f129dbe 100644 --- a/binaries/cuprated/src/rpc/request/address_book.rs +++ b/binaries/cuprated/src/rpc/request/address_book.rs @@ -65,7 +65,7 @@ pub(crate) async fn connection_info( address_type: info.address_type, avg_download: info.avg_download, avg_upload: info.avg_upload, - connection_id: String::from(FIELD_NOT_SUPPORTED), + connection_id: String::from(ConnectionId::DEFAULT_STR), current_download: info.current_download, current_upload: info.current_upload, height: info.height, diff --git a/p2p/p2p-core/src/types.rs b/p2p/p2p-core/src/types.rs index 3b7c3cb..ca56055 100644 --- a/p2p/p2p-core/src/types.rs +++ b/p2p/p2p-core/src/types.rs @@ -53,12 +53,32 @@ pub struct ConnectionInfo { pub support_flags: u32, // The following fields are slightly different than `monerod`. + // /// [`None`] if Tor/i2p or unknown. pub socket_addr: Option, - // This field does not exist for Cuprate: - // - // pub connection_id: u128, + + /// This field does not exist for `cuprated`'s RPC, this is just a marker type: + /// - + /// - + /// + /// [`ConnectionId::DEFAULT_STR`] is used when mapping to the RPC type. + pub connection_id: ConnectionId, +} + +/// Marker type for `monerod`'s connection ID. +/// +/// `connection_id` is a 128-bit `uuid` in `monerod`. +/// `cuprated` does not support this field so it returns +/// the default value in the RPC interface, an all 0-bit UUID. +/// +/// This default value in string form is [`ConnectionId::DEFAULT_STR`]. +#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct ConnectionId; + +impl ConnectionId { + /// [`str`] representation of a default connection ID. + pub const DEFAULT_STR: &str = "00000000000000000000000000000000"; } /// Used in RPC's `sync_info`.