diff --git a/main.cpp b/main.cpp index e6b7020..81e85fd 100644 --- a/main.cpp +++ b/main.cpp @@ -51,12 +51,13 @@ main(int ac, const char* av[]) auto ssl_key_file_opt = opts.get_option("ssl-key-file"); auto no_blocks_on_index_opt = opts.get_option("no-blocks-on-index"); auto testnet_url = opts.get_option("testnet-url"); - auto stagenet_url = opts.get_option("stagenet-url"); + auto stagenet_url = opts.get_option("stagenet-url"); auto mainnet_url = opts.get_option("mainnet-url"); auto mempool_info_timeout_opt = opts.get_option("mempool-info-timeout"); auto mempool_refresh_time_opt = opts.get_option("mempool-refresh-time"); auto testnet_opt = opts.get_option("testnet"); auto stagenet_opt = opts.get_option("stagenet"); + auto regnet_opt = opts.get_option("regnet"); auto enable_key_image_checker_opt = opts.get_option("enable-key-image-checker"); auto enable_output_key_checker_opt = opts.get_option("enable-output-key-checker"); auto enable_autorefresh_option_opt = opts.get_option("enable-autorefresh-option"); @@ -74,17 +75,21 @@ main(int ac, const char* av[]) bool testnet {*testnet_opt}; bool stagenet {*stagenet_opt}; + bool regnet {*regnet_opt}; - if (testnet && stagenet) + if (testnet && stagenet && regnet) { - cerr << "testnet and stagenet cannot be specified at the same time!" << endl; + cerr << "testnet, stagenet and regnet cannot be specified at the same time!" << endl; return EXIT_FAILURE; } - const cryptonote::network_type nettype = testnet ? + cryptonote::network_type nettype = testnet ? cryptonote::network_type::TESTNET : stagenet ? cryptonote::network_type::STAGENET : cryptonote::network_type::MAINNET; + if (regnet) + nettype = cryptonote::network_type::FAKECHAIN; + bool enable_pusher {*enable_pusher_opt}; bool enable_js {*enable_js_opt}; bool enable_key_image_checker {*enable_key_image_checker_opt}; diff --git a/src/CmdLineOptions.cpp b/src/CmdLineOptions.cpp index 3ff85c4..218898d 100644 --- a/src/CmdLineOptions.cpp +++ b/src/CmdLineOptions.cpp @@ -27,6 +27,8 @@ namespace xmreg "use testnet blockchain") ("stagenet,s", value()->default_value(false)->implicit_value(true), "use stagenet blockchain") + ("regnet,r", value()->default_value(false)->implicit_value(true), + "use regtest blockchain") ("enable-pusher", value()->default_value(false)->implicit_value(true), "enable signed transaction pusher") ("enable-mixin-details", value()->default_value(false)->implicit_value(true), diff --git a/src/page.h b/src/page.h index 1e2bbd6..0b92253 100644 --- a/src/page.h +++ b/src/page.h @@ -355,6 +355,7 @@ cryptonote::network_type nettype; bool mainnet; bool testnet; bool stagenet; +bool regnet; bool enable_js; @@ -452,9 +453,10 @@ page(MicroCore* _mcore, block_tx_cache(200), tx_context_cache(1000) { - mainnet = nettype == cryptonote::network_type::MAINNET; - testnet = nettype == cryptonote::network_type::TESTNET; + mainnet = nettype == cryptonote::network_type::MAINNET; + testnet = nettype == cryptonote::network_type::TESTNET; stagenet = nettype == cryptonote::network_type::STAGENET; + regnet = nettype == cryptonote::network_type::FAKECHAIN; no_of_mempool_tx_of_frontpage = 25; @@ -511,7 +513,8 @@ page(MicroCore* _mcore, // the same idea as above for the stagenet - if (stagenet) + // regnet uses same parameters as stagenet + if (stagenet && regnet) { template_file["config.js"] = std::regex_replace( template_file["config.js"], @@ -519,6 +522,7 @@ page(MicroCore* _mcore, "stagenet: true"); } + template_file["all_in_one.js"] = template_file["jquery.min.js"] + template_file["crc32.js"] + template_file["biginteger.js"] + @@ -592,6 +596,7 @@ index2(uint64_t page_no = 0, bool refresh_page = false) mstch::map context { {"testnet" , testnet}, {"stagenet" , stagenet}, + {"regnet" , regnet}, {"testnet_url" , testnet_url}, {"stagenet_url" , stagenet_url}, {"mainnet_url" , mainnet_url}, @@ -1102,6 +1107,7 @@ altblocks() mstch::map context { {"testnet" , testnet}, {"stagenet" , stagenet}, + {"regnet" , regnet}, {"blocks" , mstch::array()} }; @@ -1250,6 +1256,7 @@ show_block(uint64_t _blk_height) mstch::map context { {"testnet" , testnet}, {"stagenet" , stagenet}, + {"regnet" , regnet}, {"blk_hash" , blk_hash_str}, {"blk_height" , _blk_height}, {"blk_timestamp" , blk_timestamp}, @@ -1580,6 +1587,7 @@ show_tx(string tx_hash_str, uint16_t with_ring_signatures = 0) mstch::map context { {"testnet" , this->testnet}, {"stagenet" , this->stagenet}, + {"regnet" , this->regnet}, {"show_cache_times" , show_cache_times}, {"txs" , mstch::array{}} }; @@ -1956,6 +1964,7 @@ show_my_outputs(string tx_hash_str, mstch::map context { {"testnet" , testnet}, {"stagenet" , stagenet}, + {"regnet" , regnet}, {"tx_hash" , tx_hash_str}, {"tx_prefix_hash" , pod_to_hex(txd.prefix_hash)}, {"xmr_address" , xmr_address_str}, @@ -2538,7 +2547,8 @@ show_rawtx() // initalise page tempate map with basic info about blockchain mstch::map context { {"testnet" , testnet}, - {"stagenet" , stagenet} + {"stagenet" , stagenet}, + {"regnet" , regnet}, }; add_css_style(context); @@ -2571,6 +2581,7 @@ show_checkrawtx(string raw_tx_data, string action) mstch::map context { {"testnet" , testnet}, {"stagenet" , stagenet}, + {"regnet" , regnet}, {"unsigned_tx_given" , unsigned_tx_given}, {"have_raw_tx" , true}, {"has_error" , false}, @@ -3199,6 +3210,7 @@ show_pushrawtx(string raw_tx_data, string action) mstch::map context { {"testnet" , testnet}, {"stagenet" , stagenet}, + {"regnet" , regnet}, {"have_raw_tx" , true}, {"has_error" , false}, {"error_msg" , string {}}, @@ -3403,6 +3415,7 @@ show_rawkeyimgs() mstch::map context { {"testnet" , testnet}, {"stagenet" , stagenet}, + {"regnet" , regnet}, }; add_css_style(context); @@ -3417,7 +3430,8 @@ show_rawoutputkeys() // initalize page template context map mstch::map context { {"testnet" , testnet}, - {"stagenet" , stagenet} + {"stagenet" , stagenet}, + {"regnet" , regnet}, }; add_css_style(context); @@ -3442,6 +3456,7 @@ show_checkrawkeyimgs(string raw_data, string viewkey_str) mstch::map context{ {"testnet" , testnet}, {"stagenet" , stagenet}, + {"regnet" , regnet}, {"has_error" , false}, {"error_msg" , string{}}, }; @@ -3588,6 +3603,7 @@ show_checkcheckrawoutput(string raw_data, string viewkey_str) mstch::map context{ {"testnet" , testnet}, {"stagenet" , stagenet}, + {"regnet" , regnet}, {"has_error" , false}, {"error_msg" , string{}} };