Skip to content

Commit

Permalink
crawl block info
Browse files Browse the repository at this point in the history
  • Loading branch information
thanhson1085 committed Aug 26, 2019
1 parent 0b1ef58 commit 880ac4c
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions commands/block.js
Expand Up @@ -57,30 +57,6 @@ function getM1M2 (block) {
return { m1, m2 }
}

async function report (data) {
let m1 = {}
let m2 = {}
data.forEach(it => {
m1[it.m1] = (m1[it.m1] || 0) + 1
m2[it.m2] = (m2[it.m2] || 0) + 1
})

let map = {}
for (let k in m1) {
map[k] = {}
map[k].m1 = m1[k]
}

for (let j in m2) {
map[j] = map[j] || {}
map[j].m2 = m2[j]
}

for (let addr in map) {
logger.info(`addr ${addr} m1 ${map[addr].m1} m2 ${map[addr].m2}`)
}
}

async function getSigners (epochNumber) {
let checkpoint = (epochNumber - 1) * 900
let block = await web3Rpc.eth.getBlock(checkpoint)
Expand Down Expand Up @@ -108,16 +84,12 @@ async function run (blockHash) {
let blockNumber = block.number

let epochNumber = (blockNumber - (blockNumber % 900)) / 900 + 1
console.log(epochNumber)

let { signers, randoms } = await getSigners(epochNumber)
logger.info(`signers ${signers} randoms ${randoms}`)

let data = []
let it = await scan(block)
data.push(it)

await report(data)
return process.exit(0)
}

Expand Down

0 comments on commit 880ac4c

Please sign in to comment.