特征 'parity_scale_codec::Encode' 未实现为 'std::collections::BTreeMap<u128, T>'



这是我的结构:

#[derive(PartialEq, Eq, PartialOrd, Ord, Default, Clone, Encode, Decode, TypeInfo)]
#[cfg_attr(feature = "std", derive(Debug))]
pub struct SortitionSumTree<AccountId> {
pub k: u128,
pub stack: Vec<u128>,
pub nodes: Vec<u128>,
pub ids_to_tree_indexes: BTreeMap<AccountId, u128>,
pub node_indexes_to_ids: BTreeMap<u128, AccountId>,
}

我的存储:

#[pallet::storage]
#[pallet::getter(fn sortition_sum_trees)]
pub type SortitionSumTrees<T> = StorageMap<_, Blake2_128Concat, Vec<u8>, SortitionSumTree<T>>;

但它给出的错误:

特征CCD_ 1不用于CCD_ 2

您需要使用以下内容:

#[pallet::getter(fn sortition_sum_trees)]
pub type SortitionSumTrees<T> = StorageMap<
_, 
Blake2_128Concat,
Vec<u8>,
SortitionSumTree<T::AccountId>
>;

确保在SortitionSumTree<T::AccountId>中使用T::AccountId

相关内容

  • 没有找到相关文章

最新更新