aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2020-10-29 00:17:55 -0400
committerLee Clagett <code@leeclagett.com>2020-10-29 00:17:55 -0400
commitaad780bcfa934cf7ee6c571d054e92c97014f346 (patch)
tree1e2661e12e7e32281c7738e19e693ecb0614fa65 /src/rpc
parentMerge pull request #6902 (diff)
downloadmonero-aad780bcfa934cf7ee6c571d054e92c97014f346.tar.xz
Fix CLI and unrestricted RPC relay_tx with stempool
Diffstat (limited to 'src/rpc')
-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 382b5815f..d6fc5f4c9 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -2820,6 +2820,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 +2835,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