From 101203e2bd6d139ac59bf3649da0c370b45f1fbc Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Tue, 5 Nov 2019 08:06:11 +0800 Subject: [PATCH] add --enable-randomx flag --- README.md | 11 +++++++++-- main.cpp | 3 +++ src/CmdLineOptions.cpp | 4 +++- src/page.h | 13 ++++++++++++- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7790029..629f493 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,7 @@ xmrblocks, Onion Monero Blockchain Explorer: -t [ --testnet ] [=arg(=1)] (=0) use testnet blockchain -s [ --stagenet ] [=arg(=1)] (=0) use stagenet blockchain --enable-pusher [=arg(=1)] (=0) enable signed transaction pusher + --enable-randomx [=arg(=1)] (=0) enable generation of randomx code --enable-mixin-details [=arg(=1)] (=0) enable mixin details for key images, e.g., timescale, mixin of mixins, in tx @@ -168,7 +169,9 @@ xmrblocks, Onion Monero Blockchain Explorer: enable key images file checker --enable-output-key-checker [=arg(=1)] (=0) enable outputs key file checker - --enable-json-api [=arg(=1)] (=1) enable JSON REST api + --enable-json-api [=arg(=1)] (=0) enable JSON REST api + --enable-as-hex [=arg(=1)] (=0) enable links to provide hex + represtations of a tx and a block --enable-autorefresh-option [=arg(=1)] (=0) enable users to have the index page on autorefresh @@ -176,6 +179,7 @@ xmrblocks, Onion Monero Blockchain Explorer: enable Monero total emission monitoring thread -p [ --port ] arg (=8081) default explorer port + -x [ --bindaddr ] arg (=0.0.0.0) default bind address for the explorer --testnet-url arg you can specify testnet url, if you run it on mainnet or stagenet. link will show on front page to testnet explorer @@ -191,6 +195,9 @@ xmrblocks, Onion Monero Blockchain Explorer: for mempool data for the front page --mempool-refresh-time arg (=5) time, in seconds, for each refresh of mempool state + -c [ --concurrency ] arg (=0) number of threads handling http + queries. Default is 0 which means it is + based you on the cpu -b [ --bc-path ] arg path to lmdb folder of the blockchain, e.g., ~/.bitmonero/lmdb --ssl-crt-file arg path to crt file for ssl (https) @@ -198,7 +205,7 @@ xmrblocks, Onion Monero Blockchain Explorer: --ssl-key-file arg path to key file for ssl (https) functionality -d [ --deamon-url ] arg (=http:://127.0.0.1:18081) - Monero deamon url + Monero daemon url ``` Example usage, defined as bash aliases. diff --git a/main.cpp b/main.cpp index 0b1815e..4fc9cb2 100644 --- a/main.cpp +++ b/main.cpp @@ -71,6 +71,7 @@ main(int ac, const char* av[]) auto enable_output_key_checker_opt = opts.get_option("enable-output-key-checker"); auto enable_autorefresh_option_opt = opts.get_option("enable-autorefresh-option"); auto enable_pusher_opt = opts.get_option("enable-pusher"); + auto enable_randomx_opt = opts.get_option("enable-randomx"); auto enable_mixin_details_opt = opts.get_option("enable-mixin-details"); auto enable_json_api_opt = opts.get_option("enable-json-api"); auto enable_as_hex_opt = opts.get_option("enable-as-hex"); @@ -93,6 +94,7 @@ main(int ac, const char* av[]) cryptonote::network_type::STAGENET : cryptonote::network_type::MAINNET; bool enable_pusher {*enable_pusher_opt}; + bool enable_randomx {*enable_randomx_opt}; bool enable_key_image_checker {*enable_key_image_checker_opt}; bool enable_autorefresh_option {*enable_autorefresh_option_opt}; bool enable_output_key_checker {*enable_output_key_checker_opt}; @@ -269,6 +271,7 @@ main(int ac, const char* av[]) deamon_url, nettype, enable_pusher, + enable_randomx, enable_as_hex, enable_key_image_checker, enable_output_key_checker, diff --git a/src/CmdLineOptions.cpp b/src/CmdLineOptions.cpp index d8bad20..e42330a 100644 --- a/src/CmdLineOptions.cpp +++ b/src/CmdLineOptions.cpp @@ -29,6 +29,8 @@ namespace xmreg "use stagenet blockchain") ("enable-pusher", value()->default_value(false)->implicit_value(true), "enable signed transaction pusher") + ("enable-randomx", value()->default_value(false)->implicit_value(true), + "enable generation of randomx code") ("enable-mixin-details", value()->default_value(false)->implicit_value(true), "enable mixin details for key images, e.g., timescale, mixin of mixins, in tx context") ("enable-key-image-checker", value()->default_value(false)->implicit_value(true), @@ -68,7 +70,7 @@ namespace xmreg ("ssl-key-file", value(), "path to key file for ssl (https) functionality") ("deamon-url,d", value()->default_value("http:://127.0.0.1:18081"), - "Monero deamon url"); + "Monero daemon url"); store(command_line_parser(acc, avv) diff --git a/src/page.h b/src/page.h index 75adcf5..ba53859 100644 --- a/src/page.h +++ b/src/page.h @@ -474,6 +474,8 @@ bool stagenet; bool enable_pusher; +bool enable_randomx; + bool enable_key_image_checker; bool enable_output_key_checker; bool enable_mixins_details; @@ -506,6 +508,7 @@ page(MicroCore* _mcore, string _deamon_url, cryptonote::network_type _nettype, bool _enable_pusher, + bool _enable_randomx, bool _enable_as_hex, bool _enable_key_image_checker, bool _enable_output_key_checker, @@ -522,6 +525,7 @@ page(MicroCore* _mcore, server_timestamp {std::time(nullptr)}, nettype {_nettype}, enable_pusher {_enable_pusher}, + enable_randomx {_enable_randomx}, enable_as_hex {_enable_as_hex}, enable_key_image_checker {_enable_key_image_checker}, enable_output_key_checker {_enable_output_key_checker}, @@ -1139,7 +1143,8 @@ show_block(uint64_t _blk_height) {"delta_time" , delta_time}, {"blk_nonce" , blk.nonce}, {"blk_pow_hash" , blk_pow_hash_str}, - {"is_randomx" , (blk.major_version >= 12)}, + {"is_randomx" , (blk.major_version >= 12 + && enable_randomx == true)}, {"blk_difficulty" , blk_difficulty.str()}, {"age_format" , age.second}, {"major_ver" , std::to_string(blk.major_version)}, @@ -1242,6 +1247,12 @@ show_block(string _blk_hash) string show_randomx(uint64_t _blk_height) { + if (enable_randomx == false) + { + return "RandomX code generation disabled! Use --enable-randomx" + " flag to enable if."; + } + // get block at the given height i block blk;