From 6e4a55ba7ea00ddd50206bbe7726bb17f93336dc Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Thu, 28 May 2020 11:32:47 +0000 Subject: [PATCH 1/2] rpc: fix relay_tx error return mixup --- src/rpc/core_rpc_server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 82a7234d1..a8cffecbd 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -2778,7 +2778,7 @@ namespace cryptonote crypto::hash txid = *reinterpret_cast(txid_data.data()); cryptonote::blobdata txblob; - if (!m_core.get_pool_transaction(txid, txblob, relay_category::legacy)) + if (m_core.get_pool_transaction(txid, txblob, relay_category::legacy)) { NOTIFY_NEW_TRANSACTIONS::request r; r.txs.push_back(std::move(txblob)); From 9b86e14c5ac6e49f77a68f0833fc0bba10668e45 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Thu, 28 May 2020 12:48:38 +0000 Subject: [PATCH 2/2] functional_tests: add simple relay_tx test --- tests/functional_tests/txpool.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/functional_tests/txpool.py b/tests/functional_tests/txpool.py index 27ae89764..9b64ef994 100755 --- a/tests/functional_tests/txpool.py +++ b/tests/functional_tests/txpool.py @@ -241,6 +241,17 @@ class TransferTest(): assert x.fee == txes[txid].fee assert x.tx_blob == txes[txid].tx_blob + print('Checking relaying txes') + res = daemon.get_transaction_pool_hashes() + assert len(res.tx_hashes) > 0 + txid = res.tx_hashes[0] + daemon.relay_tx([txid]) + res = daemon.get_transactions([txid]) + assert len(res.txs) == 1 + assert res.txs[0].tx_hash == txid + assert res.txs[0].in_pool + assert res.txs[0].relayed + daemon.flush_txpool() self.check_empty_pool()