return NewSuccessResponse(count)
}
-// return block height
-func (bcr *BlockchainReactor) blockHeight() Response {
- blockHeight := map[string]uint64{"blockHeight": bcr.chain.Height()}
+// return current block count
+func (bcr *BlockchainReactor) getBlockCount() Response {
+ blockHeight := map[string]uint64{"block_count": bcr.chain.Height()}
return NewSuccessResponse(blockHeight)
}
m.Handle("/check-access-token", jsonHandler(bcr.checkAccessToken))
m.Handle("/block-hash", jsonHandler(bcr.getBestBlockHash))
- m.Handle("/block-height", jsonHandler(bcr.blockHeight))
m.Handle("/export-private-key", jsonHandler(bcr.walletExportKey))
m.Handle("/import-private-key", jsonHandler(bcr.walletImportKey))
m.Handle("/get-block-header-by-hash", jsonHandler(bcr.getBlockHeaderByHash))
m.Handle("/get-block-header-by-height", jsonHandler(bcr.getBlockHeaderByHeight))
m.Handle("/get-block", jsonHandler(bcr.getBlock))
+ m.Handle("/get-block-count", jsonHandler(bcr.getBlockCount))
m.Handle("/get-block-transactions-count-by-hash", jsonHandler(bcr.getBlockTransactionsCountByHash))
m.Handle("/get-block-transactions-count-by-height", jsonHandler(bcr.getBlockTransactionsCountByHeight))
},
}
-var blockHeightCmd = &cobra.Command{
- Use: "block-height",
+var getBlockCountCmd = &cobra.Command{
+ Use: "get-block-count",
Short: "Get the number of most recent block",
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
- data, exitCode := util.ClientCall("/block-height")
+ data, exitCode := util.ClientCall("/get-block-count")
if exitCode != util.Success {
os.Exit(exitCode)
}
BytomcliCmd.AddCommand(submitTransactionCmd)
BytomcliCmd.AddCommand(signSubTransactionCmd)
- BytomcliCmd.AddCommand(blockHeightCmd)
+ BytomcliCmd.AddCommand(getBlockCountCmd)
BytomcliCmd.AddCommand(blockHashCmd)
BytomcliCmd.AddCommand(getBlockCmd)
BytomcliCmd.AddCommand(getBlockHeaderByHashCmd)