implement parachain_key

This commit is contained in:
Robert Habermeier
2019-02-01 20:45:30 -03:00
parent 6397c786ff
commit 303a1c37f9
2 changed files with 412 additions and 242 deletions
+404 -239
View File
File diff suppressed because it is too large Load Diff
+8 -3
View File
@@ -24,7 +24,7 @@ use polkadot_primitives::parachain::{Id as ParaId, ParachainHost};
use futures::prelude::*; use futures::prelude::*;
use futures::stream; use futures::stream;
use parity_codec::Decode; use parity_codec::{Encode, Decode};
use log::warn; use log::warn;
use std::sync::Arc; use std::sync::Arc;
@@ -148,8 +148,13 @@ impl<B, E, Block, RA> LocalClient for Client<B, E, Block, RA> where
} }
} }
fn parachain_key(_para_id: ParaId) -> substrate_primitives::storage::StorageKey { fn parachain_key(para_id: ParaId) -> substrate_primitives::storage::StorageKey {
unimplemented!() const PREFIX: &[u8] = &b"Parachains Heads";
para_id.using_encoded(|s| {
let mut v = PREFIX.to_vec();
v.extend(s);
substrate_primitives::storage;:StorageKey(v)
})
} }
impl<B, E, RA> PolkadotClient for Arc<Client<B, E, PBlock, RA>> where impl<B, E, RA> PolkadotClient for Arc<Client<B, E, PBlock, RA>> where