use externalities for chain_id

This commit is contained in:
Gav
2018-01-16 19:04:13 +01:00
parent dc6ebf71cf
commit 74d5be0e80
4 changed files with 14 additions and 4 deletions
+5 -2
View File
@@ -70,8 +70,9 @@ pub fn set_storage(_key: &[u8], _value: &[u8]) {
/// The current relay chain identifier.
pub fn chain_id() -> u64 {
// TODO: fetch from Externalities.
42u64
ext::with(|holder|
holder.ext.chain_id()
).unwrap_or(0)
}
/// Execute the given closure with global function available whose functionality routes into the
@@ -105,6 +106,8 @@ mod tests {
fn set_storage(&mut self, key: Vec<u8>, value: Vec<u8>) {
self.storage.insert(key, value);
}
fn chain_id(&self) -> u64 { 42 }
}
macro_rules! map {