diff --git a/app/modules/dump.ts b/app/modules/dump.ts index ee5675d1c06277d00d78d9956691a2e7461fed1a..be4d58d13ac428ec40bed6ae6a46f06109a45a4d 100644 --- a/app/modules/dump.ts +++ b/app/modules/dump.ts @@ -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(',') || []