检查 StorageMap Substrate 中组合键的 contains_key 错误

问题描述

我有如下存储定义

    #[pallet::storage]
    #[pallet::getter(fn algos)]
    pub(super) type Algo<T: Config> = StorageMap<
        _,Blake2_128Concat,(T::AccountId,Vec<u8>),(T::Moment,Vec<u8>,T::BlockNumber),ValueQuery
    >;

但是当我检查时

ensure!(
    Algo::<T>::containkey(
    &(origin_account,algo_hash)
),Error::<T>::Exists);

它抛出以下错误

    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `EncodeLike<(<T as frame_system::Config>::AccountId,Vec<u8>)>` is not implemented for `&(Result<<T as frame_system::Config>::AccountId,frame_support::error::BadOrigin>,Vec<u8>)`
    |
    = note: required by `frame_support::pallet_prelude::StorageMap::<Prefix,Hasher,Key,Value,QueryKind,OnEmpty>::contains_key`
help: consider introducing a `where` bound,but there might be an alternative better way to express this requirement

impl<T: Config> Pallet<T> where &(Result<<T as frame_system::Config>::AccountId,Vec<u8>): EncodeLike<(<T as frame_system::Config>::AccountId,Vec<u8>)> {
    |       

如何修复此错误支持从 StorageMap 检查包含?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)