From 6007a39b8a8f52cea6d08a7c54ae7266babb298f Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 6 Jan 2020 13:21:07 +0000 Subject: [PATCH] Support blake2_128Concat key hashing --- src/metadata.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/metadata.rs b/src/metadata.rs index 7bd6df9ecf..60065feaf9 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -237,6 +237,14 @@ impl StorageMap { let encoded_key = key.encode(); let hash = match self.hasher { StorageHasher::Blake2_128 => sp_core::blake2_128(&encoded_key).to_vec(), + StorageHasher::Blake2_128Concat => { + // copied from substrate Blake2_128Concat::hash since StorageHasher is not public + sp_core::blake2_128(&encoded_key) + .iter() + .chain(&encoded_key) + .cloned() + .collect::>() + }, StorageHasher::Blake2_256 => sp_core::blake2_256(&encoded_key).to_vec(), StorageHasher::Twox128 => sp_core::twox_128(&encoded_key).to_vec(), StorageHasher::Twox256 => sp_core::twox_256(&encoded_key).to_vec(),