+
+ /// Protocol features the node announced support for
+ pub fn features(&self) -> &NodeFeatures {
+ match self {
+ NodeAnnouncementInfo::Relayed(relayed) => {
+ &relayed.contents.features
+ }
+ NodeAnnouncementInfo::Local(local) => {
+ &local.features
+ }
+ }
+ }
+
+ /// When the last known update to the node state was issued.
+ ///
+ /// Value may or may not be a timestamp, depending on the policy of the origin node.
+ pub fn last_update(&self) -> u32 {
+ match self {
+ NodeAnnouncementInfo::Relayed(relayed) => {
+ relayed.contents.timestamp
+ }
+ NodeAnnouncementInfo::Local(local) => {
+ local.last_update
+ }
+ }
+ }
+
+ /// Color assigned to the node
+ pub fn rgb(&self) -> [u8; 3] {
+ match self {
+ NodeAnnouncementInfo::Relayed(relayed) => {
+ relayed.contents.rgb
+ }
+ NodeAnnouncementInfo::Local(local) => {
+ local.rgb
+ }
+ }
+ }
+
+ /// Moniker assigned to the node.
+ ///
+ /// May be invalid or malicious (eg control chars), should not be exposed to the user.
+ pub fn alias(&self) -> &NodeAlias {
+ match self {
+ NodeAnnouncementInfo::Relayed(relayed) => {
+ &relayed.contents.alias
+ }
+ NodeAnnouncementInfo::Local(local) => {
+ &local.alias
+ }
+ }
+ }
+