aboutsummaryrefslogtreecommitdiff
path: root/src/serialization/json_object.cpp
diff options
context:
space:
mode:
authorSChernykh <sergey.v.chernykh@gmail.com>2021-07-18 17:19:32 +0200
committerSChernykh <sergey.v.chernykh@gmail.com>2021-07-18 17:19:32 +0200
commit07d82af9790d872717754b820580555a7c76f77b (patch)
treef286cdf3db7c60ef0570a5fbed126c623ddba1e7 /src/serialization/json_object.cpp
parentMerge pull request #7734 (diff)
downloadmonero-07d82af9790d872717754b820580555a7c76f77b.tar.xz
Fixed json serialization of rct::RCTTypeNull
rct::RCTTypeNull doesn't have these fields (ecdhInfo, outPk, txnFee).
Diffstat (limited to 'src/serialization/json_object.cpp')
-rw-r--r--src/serialization/json_object.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/serialization/json_object.cpp b/src/serialization/json_object.cpp
index 67f042c2e..28e207ff2 100644
--- a/src/serialization/json_object.cpp
+++ b/src/serialization/json_object.cpp
@@ -1091,9 +1091,12 @@ void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const rct::rctSig&
};
INSERT_INTO_JSON_OBJECT(dest, type, sig.type);
- INSERT_INTO_JSON_OBJECT(dest, encrypted, sig.ecdhInfo);
- INSERT_INTO_JSON_OBJECT(dest, commitments, transform(sig.outPk, just_mask));
- INSERT_INTO_JSON_OBJECT(dest, fee, sig.txnFee);
+ if (sig.type != rct::RCTTypeNull)
+ {
+ INSERT_INTO_JSON_OBJECT(dest, encrypted, sig.ecdhInfo);
+ INSERT_INTO_JSON_OBJECT(dest, commitments, transform(sig.outPk, just_mask));
+ INSERT_INTO_JSON_OBJECT(dest, fee, sig.txnFee);
+ }
// prunable
if (!sig.p.bulletproofs.empty() || !sig.p.rangeSigs.empty() || !sig.p.MGs.empty() || !sig.get_pseudo_outs().empty())
@@ -1122,9 +1125,12 @@ void fromJsonValue(const rapidjson::Value& val, rct::rctSig& sig)
}
GET_FROM_JSON_OBJECT(val, sig.type, type);
- GET_FROM_JSON_OBJECT(val, sig.ecdhInfo, encrypted);
- GET_FROM_JSON_OBJECT(val, sig.outPk, commitments);
- GET_FROM_JSON_OBJECT(val, sig.txnFee, fee);
+ if (sig.type != rct::RCTTypeNull)
+ {
+ GET_FROM_JSON_OBJECT(val, sig.ecdhInfo, encrypted);
+ GET_FROM_JSON_OBJECT(val, sig.outPk, commitments);
+ GET_FROM_JSON_OBJECT(val, sig.txnFee, fee);
+ }
// prunable
const auto prunable = val.FindMember("prunable");