[英]how to get the validators vec in runtime in substrate
我面臨着在運行時獲取驗證器的問題,基本上想將費用分配給驗證器。 但在驗證器獲取時出錯。
pub struct DealWithFees<R>(sp_std::marker::PhantomData<R>);
impl<R> OnUnbalanced<NegativeImbalance<R>> for DealWithFees<R>
where
R: pallet_balances::Config + pallet_authorship::Config,
{
fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance<R>>) {
if let Some(fees) = fees_then_tips.next() {
// for fees, 80% to treasury, 20% to author
let mut split = fees.ration(80, 20);
if let Some(tips) = fees_then_tips.next() {
// for tips, if any, 100% to author
tips.merge_into(&mut split.1);
}
// <Treasury<R> as OnUnbalanced<_>>::on_unbalanced(split.0);
<ToAuthor<R> as OnUnbalanced<_>>::on_unbalanced(split.1);
let mut validators = session::Module::<T>::validators();
}
}
}
您是否嘗試過編譯器錯誤給出的建議? 嘗試將您的 T 泛型更改為 B?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.