summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-04-28 20:45:32 +0200
committerMatthias Beyer <mail@beyermatthias.de>2020-04-28 20:45:53 +0200
commit1b5c13abf7b944f0f03a9bfd41b2ddf2afe14382 (patch)
tree62993555c7c3e7d7ff7311758d783208d1f6faf9 /src
parenta993e891b698181af2535c5a6ec4e53d2caee061 (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.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/app.rs b/src/app.rs
index 6a439c0..2368268 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -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() })
}