diff options
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 28 |
2 files changed, 26 insertions, 4 deletions
diff --git a/src/rpc/CMakeLists.txt b/src/rpc/CMakeLists.txt index 19298c969..aa4102481 100644 --- a/src/rpc/CMakeLists.txt +++ b/src/rpc/CMakeLists.txt @@ -66,7 +66,7 @@ set(rpc_pub_headers zmq_pub.h) set(daemon_rpc_server_headers) -set(rpc_daemon_private_headers +set(rpc_private_headers bootstrap_daemon.h core_rpc_server.h rpc_payment.h diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 382b5815f..fc67e2dd1 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -1131,13 +1131,18 @@ namespace cryptonote { RPC_TRACKER(send_raw_tx); + { + bool ok; + use_bootstrap_daemon_if_necessary<COMMAND_RPC_SEND_RAW_TX>(invoke_http_mode::JON, "/sendrawtransaction", req, res, 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) + if (m_should_use_bootstrap_daemon) { skip_validation = !check_core_ready(); } @@ -1146,6 +1151,10 @@ namespace cryptonote CHECK_CORE_READY(); } } + else + { + CHECK_CORE_READY(); + } CHECK_PAYMENT_MIN1(req, res, COST_PER_TX_RELAY, false); @@ -1669,6 +1678,13 @@ namespace cryptonote return false; } + uint64_t next_height; + crypto::rx_seedheights(height, &seed_height, &next_height); + if (next_height != seed_height) + next_seed_hash = m_core.get_block_id_by_height(next_height); + else + next_seed_hash = seed_hash; + if (extra_nonce.empty()) { reserved_offset = 0; @@ -2820,6 +2836,8 @@ namespace cryptonote RPC_TRACKER(relay_tx); CHECK_PAYMENT_MIN1(req, res, req.txids.size() * COST_PER_TX_RELAY, false); + const bool restricted = m_restricted && ctx; + bool failed = false; res.status = ""; for (const auto &str: req.txids) @@ -2833,12 +2851,16 @@ namespace cryptonote continue; } + //TODO: The get_pool_transaction could have an optional meta parameter + bool broadcasted = false; cryptonote::blobdata txblob; - if (m_core.get_pool_transaction(txid, txblob, relay_category::legacy)) + if ((broadcasted = m_core.get_pool_transaction(txid, txblob, relay_category::broadcasted)) || (!restricted && m_core.get_pool_transaction(txid, txblob, relay_category::all))) { + // The settings below always choose i2p/tor if enabled. Otherwise, do fluff iff previously relayed else dandelion++ stem. NOTIFY_NEW_TRANSACTIONS::request r; r.txs.push_back(std::move(txblob)); - m_core.get_protocol()->relay_transactions(r, boost::uuids::nil_uuid(), epee::net_utils::zone::invalid, relay_method::local); + const auto tx_relay = broadcasted ? relay_method::fluff : relay_method::local; + m_core.get_protocol()->relay_transactions(r, boost::uuids::nil_uuid(), epee::net_utils::zone::invalid, tx_relay); //TODO: make sure that tx has reached other nodes here, probably wait to receive reflections from other nodes } else |