Improving genesis block for PeerPlays
according http://syncad.storm.pl:56780/blocktrades/graphene/ parameterizing csv log file name
This commit is contained in:
parent
2e3cd4a75c
commit
5616fda018
2 changed files with 192 additions and 188 deletions
|
|
@ -49,6 +49,7 @@ void generate_genesis_plugin::plugin_set_program_options(
|
|||
{
|
||||
command_line_options.add_options()
|
||||
("output-genesis-file,o", bpo::value<std::string>()->default_value("genesis.json"), "Genesis file to create")
|
||||
("output-csvlog-file,o", bpo::value<std::string>()->default_value("log.csv"), "CSV log file to create")
|
||||
("snapshot-block-number", bpo::value<uint32_t>()->default_value(0), "Block number at which to snapshot balances")
|
||||
;
|
||||
config_file_options.add(command_line_options);
|
||||
|
|
@ -65,6 +66,7 @@ void generate_genesis_plugin::plugin_initialize(const boost::program_options::va
|
|||
_options = &options;
|
||||
|
||||
_genesis_filename = options["output-genesis-file"].as<std::string>();
|
||||
_csvlog_filename = options["output-csvlog-file"].as<std::string>();
|
||||
_block_to_snapshot = options["snapshot-block-number"].as<uint32_t>();
|
||||
database().applied_block.connect([this](const graphene::chain::signed_block& b){ block_applied(b); });
|
||||
ilog("generate genesis plugin: plugin_initialize() end");
|
||||
|
|
@ -221,15 +223,16 @@ void generate_genesis_plugin::generate_snapshot()
|
|||
} while (balance_iter != db_balances.begin());
|
||||
assert(remaining_amount_to_distribute == 0);
|
||||
|
||||
logfile.open("log.csv");
|
||||
logfile.open(_csvlog_filename);
|
||||
assert(logfile.is_open());
|
||||
logfile << "name,balance+orders+collaterals,balance,orders,collaterals,sharedrop\n";
|
||||
char del = ',';
|
||||
char nl = '\n';
|
||||
for( auto& o : db_balances)
|
||||
for(const auto& o : db_balances)
|
||||
{
|
||||
logfile << o.owner(d).name << del << o.balance.value << del << o.initial_balance.value << del << o.orders.value << del << o.collaterals.value << del << o.sharedrop.value << nl;
|
||||
}
|
||||
ilog("CSV log written to file ${filename}", ("filename", _csvlog_filename));
|
||||
logfile.close();
|
||||
|
||||
//auto& account_index = d.get_index_type<graphene::chain::account_index>();
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ private:
|
|||
|
||||
uint32_t _block_to_snapshot;
|
||||
std::string _genesis_filename;
|
||||
std::string _csvlog_filename;
|
||||
};
|
||||
|
||||
class my_account_balance_object : public graphene::chain::account_balance_object
|
||||
|
|
|
|||
Loading…
Reference in a new issue