output DB version in info command

This commit is contained in:
Doug Hoyte
2023-02-07 08:19:13 -05:00
parent 376d7cbf1f
commit 67d11ced30
3 changed files with 16 additions and 1 deletions

View File

@ -23,5 +23,18 @@ void cmd_info(const std::vector<std::string> &subArgs) {
auto txn = env.txn_ro();
uint64_t dbVersion;
{
auto s = env.lookup_Meta(txn, 1);
if (s) {
dbVersion = s->dbVersion();
} else {
dbVersion = 0;
}
}
std::cout << "DB version: " << dbVersion << "\n";
std::cout << "merkle root: " << to_hex(qdb.root(txn)) << "\n";
}

View File

@ -1,4 +1,5 @@
#pragma once
const uint64_t CURR_DB_VERSION = 1;
const size_t MAX_SUBID_SIZE = 71; // Statically allocated size in SubId
const uint64_t MAX_TIMESTAMP = 17179869184; // Safety limit to ensure it can fit in quadrable key. Good until year 2514.

View File

@ -5,7 +5,8 @@
#include "golpe.h"
const size_t CURR_DB_VERSION = 1;
#include "constants.h"
static void dbCheck(lmdb::txn &txn, const std::string &cmd) {
auto dbTooOld = [&](uint64_t ver) {