mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
pushing tx disabled by default. enable-pusher flag added to enable it
This commit is contained in:
parent
207418432e
commit
b51b959036
3 changed files with 30 additions and 7 deletions
15
main.cpp
15
main.cpp
|
@ -24,8 +24,9 @@ int main(int ac, const char* av[]) {
|
|||
// get command line options
|
||||
xmreg::CmdLineOptions opts {ac, av};
|
||||
|
||||
auto help_opt = opts.get_option<bool>("help");
|
||||
auto testnet_opt = opts.get_option<bool>("testnet");
|
||||
auto help_opt = opts.get_option<bool>("help");
|
||||
auto testnet_opt = opts.get_option<bool>("testnet");
|
||||
auto enable_pusher_opt = opts.get_option<bool>("enable-pusher");
|
||||
|
||||
// if help was chosen, display help text and finish
|
||||
if (*help_opt)
|
||||
|
@ -33,13 +34,15 @@ int main(int ac, const char* av[]) {
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
bool testnet {*testnet_opt};
|
||||
bool testnet {*testnet_opt};
|
||||
bool enable_pusher {*enable_pusher_opt};
|
||||
|
||||
auto port_opt = opts.get_option<string>("port");
|
||||
auto bc_path_opt = opts.get_option<string>("bc-path");
|
||||
auto custom_db_path_opt = opts.get_option<string>("custom-db-path");
|
||||
auto deamon_url_opt = opts.get_option<string>("deamon-url");
|
||||
|
||||
|
||||
//cast port number in string to uint16
|
||||
uint16_t app_port = boost::lexical_cast<uint16_t>(*port_opt);
|
||||
|
||||
|
@ -107,10 +110,12 @@ int main(int ac, const char* av[]) {
|
|||
|
||||
// create instance of page class which
|
||||
// contains logic for the website
|
||||
xmreg::page xmrblocks(&mcore, core_storage,
|
||||
xmreg::page xmrblocks(&mcore,
|
||||
core_storage,
|
||||
deamon_url,
|
||||
custom_db_path_str,
|
||||
testnet);
|
||||
testnet,
|
||||
enable_pusher);
|
||||
|
||||
// crow instance
|
||||
crow::SimpleApp app;
|
||||
|
|
|
@ -25,6 +25,8 @@ namespace xmreg
|
|||
"produce help message")
|
||||
("testnet,t", value<bool>()->default_value(false)->implicit_value(true),
|
||||
"use testnet blockchain")
|
||||
("enable-pusher", value<bool>()->default_value(false)->implicit_value(true),
|
||||
"enable pushing signed tx")
|
||||
("port,p", value<string>()->default_value("8081"),
|
||||
"default port")
|
||||
("bc-path,b", value<string>(),
|
||||
|
|
20
src/page.h
20
src/page.h
|
@ -251,17 +251,21 @@ class page {
|
|||
|
||||
bool testnet;
|
||||
|
||||
bool enable_pusher;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
page(MicroCore* _mcore, Blockchain* _core_storage,
|
||||
string _deamon_url, string _lmdb2_path, bool _testnet)
|
||||
string _deamon_url, string _lmdb2_path,
|
||||
bool _testnet, bool _enable_pusher)
|
||||
: mcore {_mcore},
|
||||
core_storage {_core_storage},
|
||||
rpc {_deamon_url},
|
||||
server_timestamp {std::time(nullptr)},
|
||||
lmdb2_path {_lmdb2_path},
|
||||
testnet {_testnet}
|
||||
testnet {_testnet},
|
||||
enable_pusher {_enable_pusher}
|
||||
{
|
||||
css_styles = xmreg::read(TMPL_CSS_STYLES);
|
||||
}
|
||||
|
@ -1960,6 +1964,18 @@ public:
|
|||
|
||||
string rpc_error_msg;
|
||||
|
||||
if (this->enable_pusher == false)
|
||||
{
|
||||
string error_msg = fmt::format(
|
||||
"Pushing signed transactions is disabled. "
|
||||
"Run explorer with --enable-pusher flag to enable it.\n");
|
||||
|
||||
context["has_error"] = true;
|
||||
context["error_msg"] = error_msg;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (!rpc.commit_tx(ptx, rpc_error_msg))
|
||||
{
|
||||
string error_msg = fmt::format(
|
||||
|
|
Loading…
Reference in a new issue