aboutsummaryrefslogtreecommitdiff
path: root/src/serialization
diff options
context:
space:
mode:
Diffstat (limited to 'src/serialization')
-rw-r--r--src/serialization/crypto.h2
-rw-r--r--src/serialization/json_object.cpp31
-rw-r--r--src/serialization/json_object.h3
3 files changed, 36 insertions, 0 deletions
diff --git a/src/serialization/crypto.h b/src/serialization/crypto.h
index 7be04c910..c2a4846ee 100644
--- a/src/serialization/crypto.h
+++ b/src/serialization/crypto.h
@@ -85,6 +85,7 @@ BLOB_SERIALIZER(crypto::secret_key);
BLOB_SERIALIZER(crypto::key_derivation);
BLOB_SERIALIZER(crypto::key_image);
BLOB_SERIALIZER(crypto::signature);
+BLOB_SERIALIZER(crypto::view_tag);
VARIANT_TAG(debug_archive, crypto::hash, "hash");
VARIANT_TAG(debug_archive, crypto::hash8, "hash8");
VARIANT_TAG(debug_archive, crypto::public_key, "public_key");
@@ -92,4 +93,5 @@ VARIANT_TAG(debug_archive, crypto::secret_key, "secret_key");
VARIANT_TAG(debug_archive, crypto::key_derivation, "key_derivation");
VARIANT_TAG(debug_archive, crypto::key_image, "key_image");
VARIANT_TAG(debug_archive, crypto::signature, "signature");
+VARIANT_TAG(debug_archive, crypto::view_tag, "view_tag");
diff --git a/src/serialization/json_object.cpp b/src/serialization/json_object.cpp
index e98e327e5..8de5860f6 100644
--- a/src/serialization/json_object.cpp
+++ b/src/serialization/json_object.cpp
@@ -563,6 +563,27 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::txout_to_key& txout)
GET_FROM_JSON_OBJECT(val, txout.key, key);
}
+void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::txout_to_tagged_key& txout)
+{
+ dest.StartObject();
+
+ INSERT_INTO_JSON_OBJECT(dest, key, txout.key);
+ INSERT_INTO_JSON_OBJECT(dest, view_tag, txout.view_tag);
+
+ dest.EndObject();
+}
+
+void fromJsonValue(const rapidjson::Value& val, cryptonote::txout_to_tagged_key& txout)
+{
+ if (!val.IsObject())
+ {
+ throw WRONG_TYPE("json object");
+ }
+
+ GET_FROM_JSON_OBJECT(val, txout.key, key);
+ GET_FROM_JSON_OBJECT(val, txout.view_tag, view_tag);
+}
+
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::tx_out& txout)
{
dest.StartObject();
@@ -578,6 +599,10 @@ void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::t
{
INSERT_INTO_JSON_OBJECT(dest, to_key, output);
}
+ void operator()(cryptonote::txout_to_tagged_key const& output) const
+ {
+ INSERT_INTO_JSON_OBJECT(dest, to_tagged_key, output);
+ }
void operator()(cryptonote::txout_to_script const& output) const
{
INSERT_INTO_JSON_OBJECT(dest, to_script, output);
@@ -616,6 +641,12 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::tx_out& txout)
fromJsonValue(elem.value, tmpVal);
txout.target = std::move(tmpVal);
}
+ else if (elem.name == "to_tagged_key")
+ {
+ cryptonote::txout_to_tagged_key tmpVal;
+ fromJsonValue(elem.value, tmpVal);
+ txout.target = std::move(tmpVal);
+ }
else if (elem.name == "to_script")
{
cryptonote::txout_to_script tmpVal;
diff --git a/src/serialization/json_object.h b/src/serialization/json_object.h
index e7caa8377..968707165 100644
--- a/src/serialization/json_object.h
+++ b/src/serialization/json_object.h
@@ -230,6 +230,9 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::txout_to_scripthash&
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::txout_to_key& txout);
void fromJsonValue(const rapidjson::Value& val, cryptonote::txout_to_key& txout);
+void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::txout_to_tagged_key& txout);
+void fromJsonValue(const rapidjson::Value& val, cryptonote::txout_to_tagged_key& txout);
+
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::tx_out& txout);
void fromJsonValue(const rapidjson::Value& val, cryptonote::tx_out& txout);