Skip to content

Commit

Permalink
update some accounts with a given json accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
hackmod committed Jan 14, 2020
1 parent aee9a12 commit 9394382
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tools/richlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require("@babel/register")({
const _ = require('lodash');
const Web3 = require('web3');
const asyncL = require('async');
const fs = require('fs');
const BigNumber = require('bignumber.js');
const mongoose = require('mongoose');

Expand Down Expand Up @@ -545,6 +546,29 @@ async function startSync(isParity) {
}
}

// only update some accounts and exit
if (process.argv[2]) {
console.log("Update accounts ...");

let addrs = process.argv[2];
try {
if (fs.existsSync(addrs)) {
let content = fs.readFileSync(addrs);
let json = JSON.parse(content);
web3.eth.getBlockNumber((err, latestBlock) => {
if (err) {
console.error(err);
process.exit(1);
}
console.log(`* latestBlock = ${latestBlock}`);
readJsonAccounts(json, latestBlock, updateAccounts);
});
}
} catch(err) {
console.error(err);
process.exit(1);
}
} else
web3.eth.getNodeInfo((err, nodeInfo) => {
let isParity = false;

Expand Down

0 comments on commit 9394382

Please sign in to comment.