diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-04-28 20:45:32 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-04-28 20:45:53 +0200 |
commit | 1b5c13abf7b944f0f03a9bfd41b2ddf2afe14382 (patch) | |
tree | 62993555c7c3e7d7ff7311758d783208d1f6faf9 /src | |
parent | a993e891b698181af2535c5a6ec4e53d2caee061 (diff) |
Fix: We need to publish a Block for the content, not the content itself
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/app.rs | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -4,10 +4,12 @@ use failure::Error; use crate::types::util::IPFSHash; use crate::types::util::IPNSHash; +use crate::types::block::Block; use crate::repository::repository::Repository; use crate::types::content::Content; use crate::types::content::Payload; use crate::types::util::Timestamp; +use crate::version::protocol_version; pub struct App { repo: Repository, @@ -30,8 +32,9 @@ impl App { let timestamp = Timestamp::now(); let content = Content::new(vec![], Some(timestamp), payload); - let head = repo.put_content(content).await?; - let device_name = repo.publish(&publishing_key, &head).await?; + let content_hash = repo.put_content(content).await?; + let head = repo.put_block(Block::new(protocol_version(), vec![], content_hash)).await?; + let device_name = repo.publish(&publishing_key, &head).await?; Ok(App { repo, device_name, publishing_key: publishing_key.to_string() }) } |