aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md8
-rw-r--r--contrib/depends/packages/sodium.mk4
-rw-r--r--contrib/depends/patches/sodium/fix-whitespace.patch4
-rw-r--r--contrib/depends/toolchain.cmake.in10
-rw-r--r--contrib/epee/src/hex.cpp8
-rw-r--r--contrib/gitian/README.md6
-rw-r--r--src/blocks/checkpoints.datbin245956 -> 255748 bytes
-rw-r--r--src/checkpoints/checkpoints.cpp1
-rw-r--r--src/cryptonote_core/blockchain.cpp2
-rw-r--r--src/p2p/net_node.inl14
-rw-r--r--src/rpc/message.cpp15
-rw-r--r--src/simplewallet/simplewallet.cpp4
-rw-r--r--src/version.cpp.in2
-rw-r--r--src/wallet/wallet2.cpp14
-rw-r--r--src/wallet/wallet2.h4
-rw-r--r--src/wallet/wallet_rpc_server.cpp4
-rw-r--r--tests/unit_tests/CMakeLists.txt4
-rw-r--r--tests/unit_tests/epee_utils.cpp3
-rw-r--r--tests/unit_tests/zmq_rpc.cpp55
19 files changed, 120 insertions, 42 deletions
diff --git a/README.md b/README.md
index e00ba468c..8a59bab10 100644
--- a/README.md
+++ b/README.md
@@ -153,7 +153,7 @@ Dates are provided in the format YYYY-MM-DD.
| 1686275 | 2018-10-19 | v9 | v0.13.0.0 | v0.13.0.4 | bulletproofs required
| 1788000 | 2019-03-09 | v10 | v0.14.0.0 | v0.14.1.2 | New PoW based on Cryptonight-R, new block weight algorithm, slightly more efficient RingCT format
| 1788720 | 2019-03-10 | v11 | v0.14.0.0 | v0.14.1.2 | forbid old RingCT transaction format
-| 1978433 | 2019-11-30* | v12 | v0.15.0.0 | v0.15.0.1 | New PoW based on RandomX, only allow >= 2 outputs, change to the block median used to calculate penalty, v1 coinbases are forbidden, rct sigs in coinbase forbidden, 10 block lock time for incoming transactions
+| 1978433 | 2019-11-30* | v12 | v0.15.0.0 | v0.15.0.5 | New PoW based on RandomX, only allow >= 2 outputs, change to the block median used to calculate penalty, v1 coinbases are forbidden, rct sigs in coinbase forbidden, 10 block lock time for incoming transactions
| XXXXXXX | XXX-XX-XX | XXX | vX.XX.X.X | vX.XX.X.X | XXX |
X's indicate that these details have not been determined as of commit date.
@@ -315,7 +315,7 @@ Tested on a Raspberry Pi Zero with a clean install of minimal Raspbian Stretch (
```bash
git clone https://github.com/monero-project/monero.git
cd monero
- git checkout tags/v0.15.0.1
+ git checkout tags/v0.15.0.5
```
* Build:
@@ -432,10 +432,10 @@ application.
cd monero
```
-* If you would like a specific [version/tag](https://github.com/monero-project/monero/tags), do a git checkout for that version. eg. 'v0.15.0.1'. If you don't care about the version and just want binaries from master, skip this step:
+* If you would like a specific [version/tag](https://github.com/monero-project/monero/tags), do a git checkout for that version. eg. 'v0.15.0.5'. If you don't care about the version and just want binaries from master, skip this step:
```bash
- git checkout v0.15.0.1
+ git checkout v0.15.0.5
```
* If you are on a 64-bit system, run:
diff --git a/contrib/depends/packages/sodium.mk b/contrib/depends/packages/sodium.mk
index dbf86fc5a..462bd2415 100644
--- a/contrib/depends/packages/sodium.mk
+++ b/contrib/depends/packages/sodium.mk
@@ -1,8 +1,8 @@
package=sodium
-$(package)_version=1.0.16
+$(package)_version=1.0.18
$(package)_download_path=https://download.libsodium.org/libsodium/releases/
$(package)_file_name=libsodium-$($(package)_version).tar.gz
-$(package)_sha256_hash=eeadc7e1e1bcef09680fb4837d448fbdf57224978f865ac1c16745868fbd0533
+$(package)_sha256_hash=6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1
$(package)_patches=fix-whitespace.patch
define $(package)_set_vars
diff --git a/contrib/depends/patches/sodium/fix-whitespace.patch b/contrib/depends/patches/sodium/fix-whitespace.patch
index efbfe4e83..c3d3af0b4 100644
--- a/contrib/depends/patches/sodium/fix-whitespace.patch
+++ b/contrib/depends/patches/sodium/fix-whitespace.patch
@@ -5,8 +5,8 @@ index b29f769..ca008ae 100755
@@ -591,7 +591,7 @@ MAKEFLAGS=
PACKAGE_NAME='libsodium'
PACKAGE_TARNAME='libsodium'
- PACKAGE_VERSION='1.0.16'
--PACKAGE_STRING='libsodium 1.0.16'
+ PACKAGE_VERSION='1.0.18'
+-PACKAGE_STRING='libsodium 1.0.18'
+PACKAGE_STRING='libsodium'
PACKAGE_BUGREPORT='https://github.com/jedisct1/libsodium/issues'
PACKAGE_URL='https://github.com/jedisct1/libsodium'
diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in
index c56f3eb2e..2634423ab 100644
--- a/contrib/depends/toolchain.cmake.in
+++ b/contrib/depends/toolchain.cmake.in
@@ -136,11 +136,21 @@ endif()
if(ARCHITECTURE STREQUAL "i686")
SET(ARCH_ID "i386")
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(BUILD_TAG "linux-x86")
SET(LINUX_32 ON)
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ set(BUILD_TAG "win-x32")
endif()
endif()
if(ARCHITECTURE STREQUAL "x86_64")
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(BUILD_TAG "linux-x64")
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+ set(BUILD_TAG "freebsd-x64")
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ set(BUILD_TAG "win-x64")
+ endif()
SET(ARCH_ID "x86_64")
endif()
diff --git a/contrib/epee/src/hex.cpp b/contrib/epee/src/hex.cpp
index 558983f7e..b654a0269 100644
--- a/contrib/epee/src/hex.cpp
+++ b/contrib/epee/src/hex.cpp
@@ -84,7 +84,7 @@ namespace epee
return write_hex(out, src);
}
- std::vector<uint8_t> from_hex::vector(boost::string_ref src)
+ std::vector<uint8_t> from_hex::vector(const boost::string_ref src)
{
// should we include a specific character
auto include = [](char input) {
@@ -104,7 +104,7 @@ namespace epee
result.reserve(count / 2);
// the data to work with (std::string is always null-terminated)
- auto data = src.data();
+ auto data = src.begin();
// convert a single hex character to an unsigned integer
auto char_to_int = [](const char *input) {
@@ -130,9 +130,9 @@ namespace epee
};
// keep going until we reach the end
- while (data[0] != '\0') {
+ while (data != src.end()) {
// skip unwanted characters
- if (!include(data[0])) {
+ if (!include(*data)) {
++data;
continue;
}
diff --git a/contrib/gitian/README.md b/contrib/gitian/README.md
index 2a8b22a7d..0da1ff506 100644
--- a/contrib/gitian/README.md
+++ b/contrib/gitian/README.md
@@ -126,7 +126,7 @@ Setup for LXC:
```bash
GH_USER=fluffypony
-VERSION=v0.15.0.1
+VERSION=v0.15.0.5
./gitian-build.py --setup $GH_USER $VERSION
```
@@ -167,7 +167,7 @@ If all went well, this produces a number of (uncommitted) `.assert` files in the
Checking your work
------------------
-Take a look in the assert files and note the SHA256 checksums listed there. eg for `v0.15.0.1` you should get this checksum:
+Take a look in the assert files and note the SHA256 checksums listed there. eg for `v0.15.0.5` you should get this checksum:
```
2b95118f53d98d542a85f8732b84ba13b3cd20517ccb40332b0edd0ddf4f8c62 monero-x86_64-linux-gnu.tar.gz
@@ -183,7 +183,7 @@ If you chose to do detached signing using `--detach-sign` above (recommended), y
```bash
GH_USER=fluffypony
-VERSION=v0.15.0.1
+VERSION=v0.15.0.5
gpg --detach-sign ${VERSION}-linux/${GH_USER}/monero-linux-*-build.assert
gpg --detach-sign ${VERSION}-win/${GH_USER}/monero-win-*-build.assert
diff --git a/src/blocks/checkpoints.dat b/src/blocks/checkpoints.dat
index 3ba55cadc..408d3ca86 100644
--- a/src/blocks/checkpoints.dat
+++ b/src/blocks/checkpoints.dat
Binary files differ
diff --git a/src/checkpoints/checkpoints.cpp b/src/checkpoints/checkpoints.cpp
index 4a4b3c5c2..a5fed1dd9 100644
--- a/src/checkpoints/checkpoints.cpp
+++ b/src/checkpoints/checkpoints.cpp
@@ -211,6 +211,7 @@ namespace cryptonote
ADD_CHECKPOINT(1775600, "1c6e01c661dc22cab939e79ec6a5272190624ce8356d2f7b958e4f9a57fdb05e");
ADD_CHECKPOINT(1856000, "9b57f17f29c71a3acd8a7904b93c41fa6eb8d2b7c73936ce4f1702d14880ba29");
ADD_CHECKPOINT(1958000, "98a5d6e51afdf3146e0eefb10a66e8648d8d4d5c2742be8835e976ba217c9bb2");
+ ADD_CHECKPOINT(2046000, "5e867f0b8baefed9244a681df97fc885d8ab36c3dfcd24c7a3abf3b8ac8b8314");
return true;
}
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 64708a580..11a6a4c0e 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -5029,7 +5029,7 @@ void Blockchain::cancel()
}
#if defined(PER_BLOCK_CHECKPOINT)
-static const char expected_block_hashes_hash[] = "bd0028887df452e58655a68015f74b923f29e9829b0b2c030d64feee67a2f537";
+static const char expected_block_hashes_hash[] = "d2ecd6b7a1937dcabd2b1108d3060a85bfdd523b2baa65f84430f674744750d5";
void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get_checkpoints)
{
if (get_checkpoints == nullptr || !m_fast_sync)
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index f8094bfa8..316ed1586 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -1058,17 +1058,15 @@ namespace nodetool
pi = context.peer_id = rsp.node_data.peer_id;
context.m_rpc_port = rsp.node_data.rpc_port;
context.m_rpc_credits_per_hash = rsp.node_data.rpc_credits_per_hash;
- m_network_zones.at(context.m_remote_address.get_zone()).m_peerlist.set_peer_just_seen(rsp.node_data.peer_id, context.m_remote_address, context.m_pruning_seed, context.m_rpc_port, context.m_rpc_credits_per_hash);
+ network_zone& zone = m_network_zones.at(context.m_remote_address.get_zone());
+ zone.m_peerlist.set_peer_just_seen(rsp.node_data.peer_id, context.m_remote_address, context.m_pruning_seed, context.m_rpc_port, context.m_rpc_credits_per_hash);
// move
- for (auto const& zone : m_network_zones)
+ if(rsp.node_data.peer_id == zone.m_config.m_peer_id)
{
- if(rsp.node_data.peer_id == zone.second.m_config.m_peer_id)
- {
- LOG_DEBUG_CC(context, "Connection to self detected, dropping connection");
- hsh_result = false;
- return;
- }
+ LOG_DEBUG_CC(context, "Connection to self detected, dropping connection");
+ hsh_result = false;
+ return;
}
LOG_INFO_CC(context, "New connection handshaked, pruning seed " << epee::string_tools::to_string_hex(context.m_pruning_seed));
LOG_DEBUG_CC(context, " COMMAND_HANDSHAKE INVOKED OK");
diff --git a/src/rpc/message.cpp b/src/rpc/message.cpp
index 158b58005..689eb5e33 100644
--- a/src/rpc/message.cpp
+++ b/src/rpc/message.cpp
@@ -52,6 +52,16 @@ constexpr const char id_field[] = "id";
constexpr const char method_field[] = "method";
constexpr const char params_field[] = "params";
constexpr const char result_field[] = "result";
+
+const rapidjson::Value& get_method_field(const rapidjson::Value& src)
+{
+ const auto member = src.FindMember(method_field);
+ if (member == src.MemberEnd())
+ throw cryptonote::json::MISSING_KEY{method_field};
+ if (!member->value.IsString())
+ throw cryptonote::json::WRONG_TYPE{"Expected string"};
+ return member->value;
+}
}
rapidjson::Value Message::toJson(rapidjson::Document& doc) const
@@ -120,7 +130,7 @@ FullMessage::FullMessage(const std::string& json_string, bool request)
if (request)
{
- OBJECT_HAS_MEMBER_OR_THROW(doc, method_field)
+ get_method_field(doc); // throws on errors
OBJECT_HAS_MEMBER_OR_THROW(doc, params_field)
}
else
@@ -151,8 +161,7 @@ std::string FullMessage::getJson()
std::string FullMessage::getRequestType() const
{
- OBJECT_HAS_MEMBER_OR_THROW(doc, method_field)
- return doc[method_field].GetString();
+ return get_method_field(doc).GetString();
}
rapidjson::Value& FullMessage::getMessage()
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index ea8f6f2f5..3a6603c95 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -8356,7 +8356,7 @@ bool simple_wallet::get_transfers(std::vector<std::string>& local_args, std::vec
m_in_manual_refresh.store(true, std::memory_order_relaxed);
epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){m_in_manual_refresh.store(false, std::memory_order_relaxed);});
- std::vector<std::pair<cryptonote::transaction, bool>> process_txs;
+ std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> process_txs;
m_wallet->update_pool_state(process_txs);
if (!process_txs.empty())
m_wallet->process_pool_state(process_txs);
@@ -10025,7 +10025,7 @@ bool simple_wallet::show_transfer(const std::vector<std::string> &args)
try
{
- std::vector<std::pair<cryptonote::transaction, bool>> process_txs;
+ std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> process_txs;
m_wallet->update_pool_state(process_txs);
if (!process_txs.empty())
m_wallet->process_pool_state(process_txs);
diff --git a/src/version.cpp.in b/src/version.cpp.in
index a7a89c945..c62233774 100644
--- a/src/version.cpp.in
+++ b/src/version.cpp.in
@@ -1,5 +1,5 @@
#define DEF_MONERO_VERSION_TAG "@VERSIONTAG@"
-#define DEF_MONERO_VERSION "0.15.0.1"
+#define DEF_MONERO_VERSION "0.15.0.5"
#define DEF_MONERO_RELEASE_NAME "Carbon Chamaeleon"
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
#define DEF_MONERO_VERSION_IS_RELEASE @VERSION_IS_RELEASE@
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index e60c6b7e1..b1c884c5e 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -2829,7 +2829,7 @@ void wallet2::remove_obsolete_pool_txs(const std::vector<crypto::hash> &tx_hashe
}
//----------------------------------------------------------------------------------------------------
-void wallet2::update_pool_state(std::vector<std::pair<cryptonote::transaction, bool>> &process_txs, bool refreshed)
+void wallet2::update_pool_state(std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> &process_txs, bool refreshed)
{
MTRACE("update_pool_state start");
@@ -3019,7 +3019,7 @@ void wallet2::update_pool_state(std::vector<std::pair<cryptonote::transaction, b
[tx_hash](const std::pair<crypto::hash, bool> &e) { return e.first == tx_hash; });
if (i != txids.end())
{
- process_txs.push_back(std::make_pair(tx, tx_entry.double_spend_seen));
+ process_txs.push_back(std::make_tuple(tx, tx_hash, tx_entry.double_spend_seen));
}
else
{
@@ -3050,14 +3050,14 @@ void wallet2::update_pool_state(std::vector<std::pair<cryptonote::transaction, b
MTRACE("update_pool_state end");
}
//----------------------------------------------------------------------------------------------------
-void wallet2::process_pool_state(const std::vector<std::pair<cryptonote::transaction, bool>> &txs)
+void wallet2::process_pool_state(const std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> &txs)
{
const time_t now = time(NULL);
for (const auto &e: txs)
{
- const cryptonote::transaction &tx = e.first;
- const bool double_spend_seen = e.second;
- const crypto::hash tx_hash = get_transaction_hash(tx);
+ const cryptonote::transaction &tx = std::get<0>(e);
+ const crypto::hash &tx_hash = std::get<1>(e);
+ const bool double_spend_seen = std::get<2>(e);
process_new_transaction(tx_hash, tx, std::vector<uint64_t>(), 0, 0, now, false, true, double_spend_seen, {});
m_scanned_pool_txs[0].insert(tx_hash);
if (m_scanned_pool_txs[0].size() > 5000)
@@ -3276,7 +3276,7 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
// since that might cause a password prompt, which would introduce a data
// leak allowing a passive adversary with traffic analysis capability to
// infer when we get an incoming output
- std::vector<std::pair<cryptonote::transaction, bool>> process_pool_txs;
+ std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> process_pool_txs;
update_pool_state(process_pool_txs, true);
bool first = true, last = false;
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index c86315f7c..79b153979 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -1219,8 +1219,8 @@ private:
bool import_key_images(signed_tx_set & signed_tx, size_t offset=0, bool only_selected_transfers=false);
crypto::public_key get_tx_pub_key_from_received_outs(const tools::wallet2::transfer_details &td) const;
- void update_pool_state(std::vector<std::pair<cryptonote::transaction, bool>> &process_txs, bool refreshed = false);
- void process_pool_state(const std::vector<std::pair<cryptonote::transaction, bool>> &txs);
+ void update_pool_state(std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> &process_txs, bool refreshed = false);
+ void process_pool_state(const std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> &txs);
void remove_obsolete_pool_txs(const std::vector<crypto::hash> &tx_hashes);
std::string encrypt(const char *plaintext, size_t len, const crypto::secret_key &skey, bool authenticated = true) const;
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index de501f056..46db624d0 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -2438,7 +2438,7 @@ namespace tools
if (req.pool)
{
- std::vector<std::pair<cryptonote::transaction, bool>> process_txs;
+ std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> process_txs;
m_wallet->update_pool_state(process_txs);
if (!process_txs.empty())
m_wallet->process_pool_state(process_txs);
@@ -2521,7 +2521,7 @@ namespace tools
}
}
- std::vector<std::pair<cryptonote::transaction, bool>> process_txs;
+ std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> process_txs;
m_wallet->update_pool_state(process_txs);
if (!process_txs.empty())
m_wallet->process_pool_state(process_txs);
diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt
index 96825f54f..17d6dfd9f 100644
--- a/tests/unit_tests/CMakeLists.txt
+++ b/tests/unit_tests/CMakeLists.txt
@@ -92,7 +92,8 @@ set(unit_tests_sources
ringdb.cpp
wipeable_string.cpp
is_hdd.cpp
- aligned.cpp)
+ aligned.cpp
+ zmq_rpc.cpp)
set(unit_tests_headers
unit_tests_utils.h)
@@ -105,6 +106,7 @@ target_link_libraries(unit_tests
ringct
cryptonote_protocol
cryptonote_core
+ daemon_messages
blockchain_db
lmdb_lib
rpc
diff --git a/tests/unit_tests/epee_utils.cpp b/tests/unit_tests/epee_utils.cpp
index 6f887afda..a4b339295 100644
--- a/tests/unit_tests/epee_utils.cpp
+++ b/tests/unit_tests/epee_utils.cpp
@@ -840,6 +840,9 @@ TEST(FromHex, String)
// decoding it this way also, ignoring spaces and colons between the numbers
hex.assign("00:ff 0f:f0");
EXPECT_EQ(source, epee::from_hex::vector(hex));
+
+ hex.append("f0");
+ EXPECT_EQ(source, epee::from_hex::vector(boost::string_ref{hex.data(), hex.size() - 2}));
}
TEST(ToHex, Array)
diff --git a/tests/unit_tests/zmq_rpc.cpp b/tests/unit_tests/zmq_rpc.cpp
new file mode 100644
index 000000000..af1f1608b
--- /dev/null
+++ b/tests/unit_tests/zmq_rpc.cpp
@@ -0,0 +1,55 @@
+// Copyright (c) 2020, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include <gtest/gtest.h>
+
+#include "rpc/message.h"
+#include "serialization/json_object.h"
+
+TEST(ZmqFullMessage, InvalidRequest)
+{
+ EXPECT_THROW(
+ (cryptonote::rpc::FullMessage{"{\"jsonrpc\":\"2.0\",\"id\":0,\"params\":[]}", true}),
+ cryptonote::json::MISSING_KEY
+ );
+ EXPECT_THROW(
+ (cryptonote::rpc::FullMessage{"{\"jsonrpc\":\"2.0\",\"id\":0,\"method\":3,\"params\":[]}", true}),
+ cryptonote::json::WRONG_TYPE
+ );
+}
+
+TEST(ZmqFullMessage, Request)
+{
+ static constexpr const char request[] = "{\"jsonrpc\":\"2.0\",\"id\":0,\"method\":\"foo\",\"params\":[]}";
+ EXPECT_NO_THROW(
+ (cryptonote::rpc::FullMessage{request, true})
+ );
+
+ cryptonote::rpc::FullMessage parsed{request, true};
+ EXPECT_STREQ("foo", parsed.getRequestType().c_str());
+}