mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 12:51:05 +00:00
remove duplicate accounts in chain-spec. (#7725)
* remove duplicate accounts in chain-spec. * Fix build * Enforce in balances modules. * Apply suggestions from code review * Update frame/balances/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -412,6 +412,12 @@ decl_storage! {
|
||||
"the balance of any account should always be at least the existential deposit.",
|
||||
)
|
||||
}
|
||||
|
||||
// ensure no duplicates exist.
|
||||
let endowed_accounts = config.balances.iter().map(|(x, _)| x).cloned().collect::<std::collections::BTreeSet<_>>();
|
||||
|
||||
assert!(endowed_accounts.len() == config.balances.len(), "duplicate balances in genesis.");
|
||||
|
||||
for &(ref who, free) in config.balances.iter() {
|
||||
T::AccountStore::insert(who, AccountData { free, .. Default::default() });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user