aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2023-07-06 21:39:19 -0500
committerluigi1111 <luigi1111w@gmail.com>2023-07-06 21:39:19 -0500
commit3be6c1389e0413b8a829f917f28aa1f347a8ff31 (patch)
treec7e691629dfe41daa9c2fbb58ee1823ff7514231 /src
parentMerge pull request #8905 (diff)
parentAdd CLSAG serialization to ZMQ code (diff)
downloadmonero-3be6c1389e0413b8a829f917f28aa1f347a8ff31.tar.xz
Merge pull request #8908
c6530d2 Add CLSAG serialization to ZMQ code (Lee Clagett)
Diffstat (limited to 'src')
-rw-r--r--src/serialization/json_object.cpp26
-rw-r--r--src/serialization/json_object.h3
2 files changed, 29 insertions, 0 deletions
diff --git a/src/serialization/json_object.cpp b/src/serialization/json_object.cpp
index 8de5860f6..43d9cfebe 100644
--- a/src/serialization/json_object.cpp
+++ b/src/serialization/json_object.cpp
@@ -1140,6 +1140,7 @@ void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const rct::rctSig&
INSERT_INTO_JSON_OBJECT(dest, bulletproofs, sig.p.bulletproofs);
INSERT_INTO_JSON_OBJECT(dest, bulletproofs_plus, sig.p.bulletproofs_plus);
INSERT_INTO_JSON_OBJECT(dest, mlsags, sig.p.MGs);
+ INSERT_INTO_JSON_OBJECT(dest, clsags, sig.p.CLSAGs);
INSERT_INTO_JSON_OBJECT(dest, pseudo_outs, sig.get_pseudo_outs());
dest.EndObject();
@@ -1175,6 +1176,7 @@ void fromJsonValue(const rapidjson::Value& val, rct::rctSig& sig)
GET_FROM_JSON_OBJECT(prunable->value, sig.p.bulletproofs, bulletproofs);
GET_FROM_JSON_OBJECT(prunable->value, sig.p.bulletproofs_plus, bulletproofs_plus);
GET_FROM_JSON_OBJECT(prunable->value, sig.p.MGs, mlsags);
+ GET_FROM_JSON_OBJECT(prunable->value, sig.p.CLSAGs, clsags);
GET_FROM_JSON_OBJECT(prunable->value, pseudo_outs, pseudo_outs);
sig.get_pseudo_outs() = std::move(pseudo_outs);
@@ -1185,6 +1187,7 @@ void fromJsonValue(const rapidjson::Value& val, rct::rctSig& sig)
sig.p.bulletproofs.clear();
sig.p.bulletproofs_plus.clear();
sig.p.MGs.clear();
+ sig.p.CLSAGs.clear();
sig.get_pseudo_outs().clear();
}
}
@@ -1393,6 +1396,29 @@ void fromJsonValue(const rapidjson::Value& val, rct::mgSig& sig)
GET_FROM_JSON_OBJECT(val, sig.cc, cc);
}
+void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const rct::clsag& sig)
+{
+ dest.StartObject();
+
+ INSERT_INTO_JSON_OBJECT(dest, s, sig.s);
+ INSERT_INTO_JSON_OBJECT(dest, c1, sig.c1);
+ INSERT_INTO_JSON_OBJECT(dest, D, sig.D);
+
+ dest.EndObject();
+}
+
+void fromJsonValue(const rapidjson::Value& val, rct::clsag& sig)
+{
+ if (!val.IsObject())
+ {
+ throw WRONG_TYPE("key64 (rct::key[64])");
+ }
+
+ GET_FROM_JSON_OBJECT(val, sig.s, s);
+ GET_FROM_JSON_OBJECT(val, sig.c1, c1);
+ GET_FROM_JSON_OBJECT(val, sig.D, D);
+}
+
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::rpc::DaemonInfo& info)
{
dest.StartObject();
diff --git a/src/serialization/json_object.h b/src/serialization/json_object.h
index 968707165..3868ab3f8 100644
--- a/src/serialization/json_object.h
+++ b/src/serialization/json_object.h
@@ -304,6 +304,9 @@ void fromJsonValue(const rapidjson::Value& val, rct::boroSig& sig);
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const rct::mgSig& sig);
void fromJsonValue(const rapidjson::Value& val, rct::mgSig& sig);
+void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const rct::clsag& sig);
+void fromJsonValue(const rapidjson::Value& val, rct::clsag& sig);
+
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::rpc::DaemonInfo& info);
void fromJsonValue(const rapidjson::Value& val, cryptonote::rpc::DaemonInfo& info);