aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/core_rpc_server.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2020-11-29 01:52:23 -0600
committerluigi1111 <luigi1111w@gmail.com>2020-11-29 01:52:23 -0600
commitbb56248acd2f0ef5e18670514012b6d47bba057a (patch)
tree73f011f8b2623ef644e05023d0cad3ac6048fa8f /src/rpc/core_rpc_server.cpp
parentMerge pull request #6943 (diff)
parentFix CLI and unrestricted RPC relay_tx with stempool (diff)
downloadmonero-bb56248acd2f0ef5e18670514012b6d47bba057a.tar.xz
Merge pull request #6949
aad780b Fix CLI and unrestricted RPC relay_tx with stempool (Lee Clagett)
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r--src/rpc/core_rpc_server.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index e72f60d05..91d1c523a 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -2827,6 +2827,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)
@@ -2840,12 +2842,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