Skip to content

Commit

Permalink
read genesis.json file correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
hackmod committed Jan 14, 2020
1 parent 1123478 commit aee9a12
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/richlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,12 +455,13 @@ var bulkInsert = function (bulk) {

function prepareJsonAddress(json, defaultType = 0) {
const accounts = {};
if (json.accounts) {
if (json.accounts || json.alloc) {
// genesis.json style
Object.keys(json.accounts).forEach((account) => {
let jsonAccounts = json.accounts || json.alloc;
Object.keys(jsonAccounts).forEach((account) => {
let key = account.toLowerCase();
key = `0x${key.replace(/^0x/, '')}`;
accounts[key] = { address: key, type };
accounts[key] = { address: key, defaultType };
});
} else if (typeof json === 'object') {
Object.keys(json).forEach((account) => {
Expand Down

0 comments on commit aee9a12

Please sign in to comment.