aboutsummaryrefslogtreecommitdiff
path: root/src/serialization/json_object.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2022-04-19 22:14:03 -0500
committerluigi1111 <luigi1111w@gmail.com>2022-04-19 22:14:03 -0500
commit96758a7d05bb1747951ffac87a307d592f882655 (patch)
tree20900ece7aacd538bb3bacba72e7592e03bd915f /src/serialization/json_object.cpp
parentMerge pull request #8211 (diff)
parentAdd view tags to outputs to reduce wallet scanning time (diff)
downloadmonero-96758a7d05bb1747951ffac87a307d592f882655.tar.xz
Merge pull request #8061
ea87b30 Add view tags to outputs to reduce wallet scanning time (j-berman)
Diffstat (limited to 'src/serialization/json_object.cpp')
-rw-r--r--src/serialization/json_object.cpp31
1 files changed, 31 insertions, 0 deletions
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;