-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Process indices & more utility fns (#151)
* More tools * Process indices * More error logs Signed-off-by: Xavier Lau <[email protected]> Signed-off-by: Xavier Lau <[email protected]>
- Loading branch information
1 parent
22e95f7
commit 08b703a
Showing
6 changed files
with
98 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Process steps | ||
- take solo `Indices::Accounts` | ||
- adjust the reserved's decimals then free solo `Indices` reservations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// darwinia | ||
use crate::*; | ||
|
||
impl Processor { | ||
pub fn process_indices(&mut self) -> &mut Self { | ||
// Storage items. | ||
// https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/indices/src/lib.rs#L291 | ||
let mut accounts = <Map<([u8; 32], u128, bool)>>::default(); | ||
|
||
log::info!("take solo `Indices::Accounts`"); | ||
self.solo_state.take_map(b"Indices", b"Accounts", &mut accounts, get_identity_key); | ||
|
||
// https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/indices/src/lib.rs#L154 | ||
log::info!("adjust the reserved's decimals then free solo `Indices` reservations"); | ||
accounts.into_iter().for_each(|(_, (a, mut v, _))| { | ||
v.adjust(); | ||
self.shell_state.unreserve(a, v); | ||
}); | ||
|
||
self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters