From c6512c1b86406497de71b5fe64d320ce88a8d77e Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Fri, 29 Mar 2019 12:50:48 +0200 Subject: [PATCH] disable and clearn account indices, no account index created for new accounts --- src/lib.rs | 4 ++-- src/migration.rs | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index bf8bba4662..4db5b8c809 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -182,9 +182,9 @@ impl balances::Trait for Runtime { /// The type for recording an account's balance. type Balance = u128; /// What to do if an account's free balance gets zeroed. - type OnFreeBalanceZero = Staking; + type OnFreeBalanceZero = (); /// What to do if a new account is created. - type OnNewAccount = Indices; + type OnNewAccount = (); /// Restrict whether an account can transfer funds. We don't place any further restrictions. type EnsureAccountLiquid = Staking; /// The uniquitous event type. diff --git a/src/migration.rs b/src/migration.rs index d835e0a17d..6dcf68c601 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -1,13 +1,15 @@ #![cfg_attr(not(feature = "std"), no_std)] -use srml_support::{StorageValue, dispatch::Result, decl_module, decl_storage, decl_event, ensure}; +use srml_support::{StorageValue, StorageMap, dispatch::Result, decl_module, decl_storage, decl_event, ensure}; +use runtime_primitives::traits::{As}; use system; use rstd::prelude::*; use runtime_io::print; use crate::{VERSION}; use crate::membership::members; +use {indices}; -pub trait Trait: system::Trait + members::Trait { +pub trait Trait: system::Trait + members::Trait + indices::Trait { type Event: From> + Into<::Event>; } @@ -40,6 +42,12 @@ impl Module { >::initialize_storage(); + + // Clear account indices + for i in 0..65535 { + >::remove(&::AccountIndex::sa(i)); + } + // ... // add initialization of other modules introduced in this runtime // ...