diff --git a/agent/provider/src/provider_agent.rs b/agent/provider/src/provider_agent.rs index 62361bb66a..29079b035f 100644 --- a/agent/provider/src/provider_agent.rs +++ b/agent/provider/src/provider_agent.rs @@ -293,9 +293,8 @@ impl ProviderAgent { Ok(NodeInfo { name: globals.node_name, subnet: globals.subnet, - geo_country_code: None, is_public: status.public_ip.is_some(), - protocol_version: 3, + ..Default::default() }) } @@ -641,9 +640,8 @@ mod tests { let node_info = NodeInfo { name: Some("node_name".to_string()), subnet: Some("subnet".to_string()), - geo_country_code: None, is_public: true, - protocol_version: 3, + ..Default::default() }; let inf_node_info = InfNodeInfo::default(); let accounts = Vec::new(); diff --git a/utils/agreement-utils/src/typed_props.rs b/utils/agreement-utils/src/typed_props.rs index a909a582e4..805db66df8 100644 --- a/utils/agreement-utils/src/typed_props.rs +++ b/utils/agreement-utils/src/typed_props.rs @@ -39,16 +39,25 @@ pub struct NodeInfo { pub protocol_version: u32, } -impl NodeInfo { - pub fn with_name(name: impl Into) -> Self { +impl Default for NodeInfo { + fn default() -> Self { NodeInfo { - name: Some(name.into()), - geo_country_code: None, + name: None, subnet: None, + geo_country_code: None, is_public: false, protocol_version: 3, } } +} + +impl NodeInfo { + pub fn with_name(name: impl Into) -> Self { + NodeInfo { + name: Some(name.into()), + ..Default::default() + } + } pub fn with_subnet(&mut self, subnet: String) -> &mut Self { self.subnet = Some(subnet);