Skip to content

Commit

Permalink
Fix state root hash
Browse files Browse the repository at this point in the history
  • Loading branch information
KillianH committed Jul 19, 2023
1 parent 40f5068 commit 3308762
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions routes/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ async function updateValidators(force = false) {
console.log('No refresh account info');
}
const validatorsInfo = (await client.casperRPC.getValidatorsInfo()).auction_state.bids;
const stateRootHash = await client.casperRPC.getStateRootHash(
(await client.casperRPC.getLatestBlockInfo()).block.hash,
);
const stateRootHash = await client.casperRPC.getStateRootHash();
const validators = (await client.casperRPC.getValidatorsInfo()).auction_state.era_validators;
const currentEra = validators[0].validator_weights.map(v => v.public_key);
const nextEra = validators[1].validator_weights.map(v => v.public_key);
Expand Down Expand Up @@ -284,9 +282,7 @@ router.get('/accountinfos/:hash', async function(req, res, next) {

router.get('/metadata/:hash', async function(req, res, next) {
try {
const stateRootHash = await client.casperRPC.getStateRootHash(
(await client.casperRPC.getLatestBlockInfo()).block.hash,
);
const stateRootHash = await client.casperRPC.getStateRootHash();
res.send(await getAccountInfoData(req.params.hash, stateRootHash));
} catch (e) {
res.sendStatus(404);
Expand Down

0 comments on commit 3308762

Please sign in to comment.