Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Commit

Permalink
Make sure address function of entry delegates to AgentId::address() i…
Browse files Browse the repository at this point in the history
…f the entry is an AgendId entry.
  • Loading branch information
lucksus committed Dec 7, 2018
1 parent 6955178 commit 6f494af
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core_types/src/entry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use link::{link_add::LinkAdd, link_list::LinkList, link_remove::LinkRemove};
use serde::{ser::SerializeTuple, Deserialize, Deserializer, Serializer};
use snowflake;
use std::convert::TryFrom;
use multihash::Hash;

pub type AppEntryValue = JsonString;

Expand Down Expand Up @@ -98,6 +99,13 @@ impl PartialEq for Entry {
}

impl AddressableContent for Entry {
fn address(&self) -> Address {
match &self {
Entry::AgentId(agent_id) => agent_id.address(),
_ => Address::encode_from_str(&String::from(self.content()), Hash::SHA2256),
}
}

fn content(&self) -> Content {
self.into()
}
Expand Down

0 comments on commit 6f494af

Please sign in to comment.