Skip to content

Commit

Permalink
Merge pull request #6198
Browse files Browse the repository at this point in the history
5f2a32c daemon: run with -rpc-payment-address and --rpc-restricted-bind-port (moneromooo-monero)
  • Loading branch information
luigi1111 committed Feb 20, 2020
2 parents 04187e5 + 5f2a32c commit 39e1890
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
9 changes: 5 additions & 4 deletions src/daemon/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,14 @@ struct t_internals {

const auto restricted = command_line::get_arg(vm, cryptonote::core_rpc_server::arg_restricted_rpc);
const auto main_rpc_port = command_line::get_arg(vm, cryptonote::core_rpc_server::arg_rpc_bind_port);
rpcs.emplace_back(new t_rpc{vm, core, p2p, restricted, main_rpc_port, "core"});
const auto restricted_rpc_port_arg = cryptonote::core_rpc_server::arg_rpc_restricted_bind_port;
const bool has_restricted_rpc_port_arg = !command_line::is_arg_defaulted(vm, restricted_rpc_port_arg);
rpcs.emplace_back(new t_rpc{vm, core, p2p, restricted, main_rpc_port, "core", !has_restricted_rpc_port_arg});

auto restricted_rpc_port_arg = cryptonote::core_rpc_server::arg_rpc_restricted_bind_port;
if(!command_line::is_arg_defaulted(vm, restricted_rpc_port_arg))
if(has_restricted_rpc_port_arg)
{
auto restricted_rpc_port = command_line::get_arg(vm, restricted_rpc_port_arg);
rpcs.emplace_back(new t_rpc{vm, core, p2p, true, restricted_rpc_port, "restricted"});
rpcs.emplace_back(new t_rpc{vm, core, p2p, true, restricted_rpc_port, "restricted", true});
}
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/daemon/rpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@ class t_rpc final
, const bool restricted
, const std::string & port
, const std::string & description
, bool allow_rpc_payment
)
: m_server{core.get(), p2p.get()}, m_description{description}
{
MGINFO("Initializing " << m_description << " RPC server...");

if (!m_server.init(vm, restricted, port))
if (!m_server.init(vm, restricted, port, allow_rpc_payment))
{
throw std::runtime_error("Failed to initialize " + m_description + " RPC server.");
}
Expand Down
3 changes: 2 additions & 1 deletion src/rpc/core_rpc_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ namespace cryptonote
const boost::program_options::variables_map& vm
, const bool restricted
, const std::string& port
, bool allow_rpc_payment
)
{
m_restricted = restricted;
Expand All @@ -247,7 +248,7 @@ namespace cryptonote
return false;

std::string address = command_line::get_arg(vm, arg_rpc_payment_address);
if (!address.empty())
if (!address.empty() && allow_rpc_payment)
{
if (!m_restricted && nettype() != FAKECHAIN)
{
Expand Down
3 changes: 2 additions & 1 deletion src/rpc/core_rpc_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ namespace cryptonote
bool init(
const boost::program_options::variables_map& vm,
const bool restricted,
const std::string& port
const std::string& port,
bool allow_rpc_payment
);
network_type nettype() const { return m_core.get_nettype(); }

Expand Down

0 comments on commit 39e1890

Please sign in to comment.