Skip to content
Snippets Groups Projects
Commit 4795582d authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[enh] dump: added `current` subcommand to show current block

parent 4026ebdc
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@ import {Server} from "../../server"
import {moment} from "../lib/common-libs/moment"
import {DBBlock} from "../lib/db/DBBlock"
import {SindexEntry} from "../lib/indexer"
import {BlockDTO} from "../lib/dto/BlockDTO"
const Table = require('cli-table')
......@@ -33,6 +34,10 @@ module.exports = {
const cond: string = params[2] || ''
switch (what) {
case 'current':
await dumpCurrent(server)
break
case 'table':
await dumpTable(server, name, cond)
break
......@@ -52,6 +57,16 @@ module.exports = {
}
}
async function dumpCurrent(server: Server) {
const current = await server.dal.getCurrentBlockOrNull()
if (!current) {
console.log('')
}
else {
console.log(BlockDTO.fromJSONObject(current).getRawSigned())
}
}
async function dumpTable(server: Server, name: string, condition?: string) {
const criterion: any = {}
const filters = condition && condition.split(',') || []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment