Adding functions to get block contents for debugging.

This commit is contained in:
clemahieu 2017-01-10 11:05:43 -06:00
commit fbfedd47bc
2 changed files with 19 additions and 0 deletions

View file

@ -2704,6 +2704,23 @@ bool rai::ledger::block_exists (rai::block_hash const & hash_a)
return result;
}
std::string rai::ledger::block_text (char const * hash_a)
{
return block_text (rai::block_hash (hash_a));
}
std::string rai::ledger::block_text (rai::block_hash const & hash_a)
{
std::string result;
rai::transaction transaction (store.environment, nullptr, false);
auto block (store.block_get (transaction, hash_a));
if (block != nullptr)
{
block->serialize_json (result);
}
return result;
}
// Vote weight of an account
rai::uint128_t rai::ledger::weight (MDB_txn * transaction_a, rai::account const & account_a)
{

View file

@ -463,6 +463,8 @@ public:
rai::block_hash representative (MDB_txn *, rai::block_hash const &);
rai::block_hash representative_calculated (MDB_txn *, rai::block_hash const &);
bool block_exists (rai::block_hash const &);
std::string block_text (char const *);
std::string block_text (rai::block_hash const &);
rai::uint128_t supply (MDB_txn *);
rai::process_return process (MDB_txn *, rai::block const &);
bool rollback (MDB_txn *, rai::block_hash const &);