Merge pull request #6763

728ba38b1 rpc: always send raw txes through P2P (don't use bootstrap daemon) (xiphon)
This commit is contained in:
Alexander Blair 2020-08-27 03:02:30 -07:00
commit 27b49033fd
No known key found for this signature in database
GPG Key ID: C64552D877C32479

View File

@ -1120,11 +1120,23 @@ namespace cryptonote
bool core_rpc_server::on_send_raw_tx(const COMMAND_RPC_SEND_RAW_TX::request& req, COMMAND_RPC_SEND_RAW_TX::response& res, const connection_context *ctx)
{
RPC_TRACKER(send_raw_tx);
bool ok;
if (use_bootstrap_daemon_if_necessary<COMMAND_RPC_SEND_RAW_TX>(invoke_http_mode::JON, "/sendrawtransaction", req, res, ok))
return ok;
const bool restricted = m_restricted && ctx;
bool skip_validation = false;
if (!restricted)
{
boost::shared_lock<boost::shared_mutex> lock(m_bootstrap_daemon_mutex);
if (m_bootstrap_daemon.get() != nullptr)
{
skip_validation = !check_core_ready();
}
else
{
CHECK_CORE_READY();
}
}
CHECK_PAYMENT_MIN1(req, res, COST_PER_TX_RELAY, false);
std::string tx_blob;
@ -1144,8 +1156,8 @@ namespace cryptonote
}
res.sanity_check_failed = false;
const bool restricted = m_restricted && ctx;
if (!skip_validation)
{
tx_verification_context tvc{};
if(!m_core.handle_incoming_tx({tx_blob, crypto::null_hash}, tvc, (req.do_not_relay ? relay_method::none : relay_method::local), false) || tvc.m_verifivation_failed)
{
@ -1187,6 +1199,7 @@ namespace cryptonote
res.status = CORE_RPC_STATUS_OK;
return true;
}
}
NOTIFY_NEW_TRANSACTIONS::request r;
r.txs.push_back(std::move(tx_blob));