diff --git a/nano/nano_node/entry.cpp b/nano/nano_node/entry.cpp index 1adc2447..c00c8c12 100644 --- a/nano/nano_node/entry.cpp +++ b/nano/nano_node/entry.cpp @@ -34,6 +34,7 @@ int main (int argc, char * const * argv) ("batch_size",boost::program_options::value (), "Increase sideband batch size, default 512") ("debug_block_count", "Display the number of block") ("debug_bootstrap_generate", "Generate bootstrap sequence of blocks") + ("debug_dump_online_weight", "Dump online_weights table") ("debug_dump_representatives", "List representatives and weights") ("debug_account_count", "Display the number of accounts") ("debug_mass_activity", "Generates fake debug activity") @@ -165,6 +166,22 @@ int main (int argc, char * const * argv) result = -1; } } + else if (vm.count ("debug_dump_online_weight")) + { + nano::inactive_node node (data_path); + auto current (node.node->online_reps.online_stake ()); + std::cout << boost::str (boost::format ("Online Weight %1%\n") % current); + auto transaction (node.node->store.tx_begin_read ()); + for (auto i (node.node->store.online_weight_begin (transaction)), n (node.node->store.online_weight_end ()); i != n; ++i) + { + using time_point = std::chrono::system_clock::time_point; + time_point ts (std::chrono::duration_cast (std::chrono::nanoseconds (i->first))); + std::time_t timestamp = std::chrono::system_clock::to_time_t (ts); + std::string weight; + i->second.encode_dec (weight); + std::cout << boost::str (boost::format ("Timestamp %1% Weight %2%\n") % ctime (×tamp) % weight); + } + } else if (vm.count ("debug_dump_representatives")) { nano::inactive_node node (data_path);