Export fn code_hash (#12479)

Co-authored-by: parity-processbot <>
This commit is contained in:
Kevin Wang
2022-10-17 14:27:24 +08:00
committed by GitHub
parent 0e729f2327
commit 68e2513265
2 changed files with 5 additions and 1 deletions
+5
View File
@@ -1031,6 +1031,11 @@ where
T::AddressGenerator::generate_address(deploying_address, code_hash, salt) T::AddressGenerator::generate_address(deploying_address, code_hash, salt)
} }
/// Returns the code hash of the contract specified by `account` ID.
pub fn code_hash(account: &AccountIdOf<T>) -> Option<CodeHash<T>> {
Storage::<T>::code_hash(account)
}
/// Store code for benchmarks which does not check nor instrument the code. /// Store code for benchmarks which does not check nor instrument the code.
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
fn store_code_raw( fn store_code_raw(
-1
View File
@@ -328,7 +328,6 @@ where
} }
/// Returns the code hash of the contract specified by `account` ID. /// Returns the code hash of the contract specified by `account` ID.
#[cfg(test)]
pub fn code_hash(account: &AccountIdOf<T>) -> Option<CodeHash<T>> { pub fn code_hash(account: &AccountIdOf<T>) -> Option<CodeHash<T>> {
<ContractInfoOf<T>>::get(account).map(|i| i.code_hash) <ContractInfoOf<T>>::get(account).map(|i| i.code_hash)
} }