rpc: always send raw txes through P2P (don't use bootstrap daemon)

It turns out that some remote (bootstrap) nodes silently drop /
don't broadcast client's transactions.
This commit is contained in:
xiphon 2020-08-15 15:49:11 +00:00
parent c108c5e2f0
commit 728ba38b11
1 changed files with 55 additions and 42 deletions

View File

@ -1119,11 +1119,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;
@ -1143,8 +1155,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)
{
@ -1186,6 +1198,7 @@ namespace cryptonote
res.status = CORE_RPC_STATUS_OK;
return true;
}
}
NOTIFY_NEW_TRANSACTIONS::request r;
r.txs.push_back(std::move(tx_blob));