Fixed json serialization of rct::RCTTypeNull

rct::RCTTypeNull doesn't have these fields (ecdhInfo, outPk, txnFee).
This commit is contained in:
SChernykh 2021-07-18 10:52:14 +02:00 committed by wowario
parent a661aa2484
commit 303117450e

View file

@ -1097,9 +1097,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, type, sig.type);
INSERT_INTO_JSON_OBJECT(dest, encrypted, sig.ecdhInfo); if (sig.type != rct::RCTTypeNull)
INSERT_INTO_JSON_OBJECT(dest, commitments, transform(sig.outPk, just_mask)); {
INSERT_INTO_JSON_OBJECT(dest, fee, sig.txnFee); 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 // prunable
if (!sig.p.bulletproofs.empty() || !sig.p.bulletproofs_plus.empty() || !sig.p.rangeSigs.empty() || !sig.p.MGs.empty() || !sig.get_pseudo_outs().empty()) if (!sig.p.bulletproofs.empty() || !sig.p.bulletproofs_plus.empty() || !sig.p.rangeSigs.empty() || !sig.p.MGs.empty() || !sig.get_pseudo_outs().empty())
@ -1129,9 +1132,12 @@ void fromJsonValue(const rapidjson::Value& val, rct::rctSig& sig)
} }
GET_FROM_JSON_OBJECT(val, sig.type, type); GET_FROM_JSON_OBJECT(val, sig.type, type);
GET_FROM_JSON_OBJECT(val, sig.ecdhInfo, encrypted); if (sig.type != rct::RCTTypeNull)
GET_FROM_JSON_OBJECT(val, sig.outPk, commitments); {
GET_FROM_JSON_OBJECT(val, sig.txnFee, fee); 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 // prunable
const auto prunable = val.FindMember("prunable"); const auto prunable = val.FindMember("prunable");