fix: use Cid v0 for subscriptions

Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
ljedrz
2020-07-13 12:44:18 +02:00
parent 0d36e9c149
commit 7cbf65a373
2 changed files with 5 additions and 5 deletions

View File

@ -134,7 +134,7 @@ trait CidUpgrade: Sized {
}
/// Extension trait similar to [`CidUpgrade`] but for non-owned types.
trait CidUpgradedRef: Sized {
pub trait CidUpgradedRef: Sized {
/// Returns the otherwise the equivalent value from `&self` but with Cid version 1
fn as_upgraded_cid(&self) -> Self;
}
@ -221,8 +221,7 @@ impl<TRepoTypes: RepoTypes> Repo<TRepoTypes> {
self.subscriptions
.lock()
.await
// subscriptions are per cidv1
.finish_subscription(&cid.clone().into(), block);
.finish_subscription(&original_cid.clone().into(), block);
// sending only fails if no one is listening anymore
// and that is okay with us.
self.events
@ -249,8 +248,7 @@ impl<TRepoTypes: RepoTypes> Repo<TRepoTypes> {
.subscriptions
.lock()
.await
// subscribe always by using the cidv1
.create_subscription(upgraded.clone().into(), Some(self.events.clone()));
.create_subscription(cid.clone().into(), Some(self.events.clone()));
// sending only fails if no one is listening anymore
// and that is okay with us.
self.events

View File

@ -1,3 +1,5 @@
use ipfs::repo::CidUpgradedRef;
use async_std::{
future::{pending, timeout},
task,