@@ -6,6 +6,7 @@ program.option("--startNum <startNum>", "start num")
6
6
program . option ( "--endNum <endNum>" , "end num" )
7
7
program . option ( "--miner <miner>" , "miner" , "" )
8
8
program . option ( "--num <Num>" , "validator num" , 21 )
9
+ program . option ( "--turnLength <Num>" , "the consecutive block length" , 4 )
9
10
program . option ( "--topNum <Num>" , "top num of address to be displayed" , 20 )
10
11
program . option ( "--blockNum <Num>" , "block num" , 0 )
11
12
program . option ( "-h, --help" , "" )
@@ -34,7 +35,7 @@ function printUsage() {
34
35
console . log ( "\nExample:" ) ;
35
36
// mainnet https://bsc-mainnet.nodereal.io/v1/454e504917db4f82b756bd0cf6317dce
36
37
console . log ( " node getchainstatus.js GetMaxTxCountInBlockRange --rpc https://bsc-testnet-dataseed.bnbchain.org --startNum 40000001 --endNum 40000005" )
37
- console . log ( " node getchainstatus.js GetBinaryVersion --rpc https://bsc-testnet-dataseed.bnbchain.org --num 21" )
38
+ console . log ( " node getchainstatus.js GetBinaryVersion --rpc https://bsc-testnet-dataseed.bnbchain.org --num 21 --turnLength 4 " )
38
39
console . log ( " node getchainstatus.js GetTopAddr --rpc https://bsc-testnet-dataseed.bnbchain.org --startNum 40000001 --endNum 40000010 --topNum 10" )
39
40
console . log ( " node getchainstatus.js GetSlashCount --rpc https://bsc-testnet-dataseed.bnbchain.org --blockNum 40000001" ) // default: latest block
40
41
console . log ( " node getchainstatus.js GetPerformanceData --rpc https://bsc-testnet-dataseed.bnbchain.org --startNum 40000001 --endNum 40000010" )
@@ -193,12 +194,13 @@ async function getMaxTxCountInBlockRange() {
193
194
// 2.cmd: "GetBinaryVersion", usage:
194
195
// node getchainstatus.js GetBinaryVersion \
195
196
// --rpc https://bsc-testnet-dataseed.bnbchain.org \
196
- // --num(optional): defualt 21, the number of blocks that will be checked
197
+ // --num(optional): default 21, the number of blocks that will be checked
198
+ // --turnLength(optional): default 4, the consecutive block length
197
199
async function getBinaryVersion ( ) {
198
200
const blockNum = await provider . getBlockNumber ( ) ;
199
- console . log ( blockNum ) ;
201
+ let turnLength = program . turnLength
200
202
for ( let i = 0 ; i < program . num ; i ++ ) {
201
- let blockData = await provider . getBlock ( blockNum - i ) ;
203
+ let blockData = await provider . getBlock ( blockNum - i * turnLength ) ;
202
204
// 1.get Geth client version
203
205
let major = ethers . toNumber ( ethers . dataSlice ( blockData . extraData , 2 , 3 ) )
204
206
let minor = ethers . toNumber ( ethers . dataSlice ( blockData . extraData , 3 , 4 ) )
@@ -215,7 +217,8 @@ async function getBinaryVersion() {
215
217
lastGasPrice = txData . gasPrice
216
218
break
217
219
}
218
- console . log ( blockData . miner , "version =" , major + "." + minor + "." + patch , " MinGasPrice = " + lastGasPrice )
220
+ var moniker = await getValidatorMoniker ( blockData . miner , blockNum )
221
+ console . log ( blockNum - i * turnLength , blockData . miner , "version =" , major + "." + minor + "." + patch , " MinGasPrice = " + lastGasPrice , moniker )
219
222
}
220
223
} ;
221
224
0 commit comments