mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-22 23:18:55 +00:00
Fix pruned tx for ZMQ's GetBlocksFast
This commit is contained in:
parent
c108c5e2f0
commit
fe96e66ebe
@ -182,6 +182,7 @@ namespace rpc
|
|||||||
for (const auto& blob : it->second)
|
for (const auto& blob : it->second)
|
||||||
{
|
{
|
||||||
bwt.transactions.emplace_back();
|
bwt.transactions.emplace_back();
|
||||||
|
bwt.transactions.back().pruned = req.prune;
|
||||||
if (!parse_and_validate_tx_from_blob(blob.second, bwt.transactions.back()))
|
if (!parse_and_validate_tx_from_blob(blob.second, bwt.transactions.back()))
|
||||||
{
|
{
|
||||||
res.blocks.clear();
|
res.blocks.clear();
|
||||||
|
@ -42,6 +42,7 @@ monero_add_library(serialization
|
|||||||
${serialization_private_headers})
|
${serialization_private_headers})
|
||||||
target_link_libraries(serialization
|
target_link_libraries(serialization
|
||||||
LINK_PRIVATE
|
LINK_PRIVATE
|
||||||
|
cryptonote_basic
|
||||||
cryptonote_core
|
cryptonote_core
|
||||||
cryptonote_protocol
|
cryptonote_protocol
|
||||||
epee
|
epee
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "cryptonote_basic/cryptonote_basic_impl.h"
|
||||||
|
|
||||||
// drop macro from windows.h
|
// drop macro from windows.h
|
||||||
#ifdef GetObject
|
#ifdef GetObject
|
||||||
#undef GetObject
|
#undef GetObject
|
||||||
@ -246,7 +248,10 @@ void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::t
|
|||||||
INSERT_INTO_JSON_OBJECT(dest, inputs, tx.vin);
|
INSERT_INTO_JSON_OBJECT(dest, inputs, tx.vin);
|
||||||
INSERT_INTO_JSON_OBJECT(dest, outputs, tx.vout);
|
INSERT_INTO_JSON_OBJECT(dest, outputs, tx.vout);
|
||||||
INSERT_INTO_JSON_OBJECT(dest, extra, tx.extra);
|
INSERT_INTO_JSON_OBJECT(dest, extra, tx.extra);
|
||||||
|
if (!tx.pruned)
|
||||||
|
{
|
||||||
INSERT_INTO_JSON_OBJECT(dest, signatures, tx.signatures);
|
INSERT_INTO_JSON_OBJECT(dest, signatures, tx.signatures);
|
||||||
|
}
|
||||||
INSERT_INTO_JSON_OBJECT(dest, ringct, tx.rct_signatures);
|
INSERT_INTO_JSON_OBJECT(dest, ringct, tx.rct_signatures);
|
||||||
|
|
||||||
dest.EndObject();
|
dest.EndObject();
|
||||||
@ -265,8 +270,17 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::transaction& tx)
|
|||||||
GET_FROM_JSON_OBJECT(val, tx.vin, inputs);
|
GET_FROM_JSON_OBJECT(val, tx.vin, inputs);
|
||||||
GET_FROM_JSON_OBJECT(val, tx.vout, outputs);
|
GET_FROM_JSON_OBJECT(val, tx.vout, outputs);
|
||||||
GET_FROM_JSON_OBJECT(val, tx.extra, extra);
|
GET_FROM_JSON_OBJECT(val, tx.extra, extra);
|
||||||
GET_FROM_JSON_OBJECT(val, tx.signatures, signatures);
|
|
||||||
GET_FROM_JSON_OBJECT(val, tx.rct_signatures, ringct);
|
GET_FROM_JSON_OBJECT(val, tx.rct_signatures, ringct);
|
||||||
|
|
||||||
|
const auto& sigs = val.FindMember("signatures");
|
||||||
|
if (sigs != val.MemberEnd())
|
||||||
|
{
|
||||||
|
fromJsonValue(sigs->value, tx.signatures);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& rsig = tx.rct_signatures;
|
||||||
|
if (!cryptonote::is_coinbase(tx) && rsig.p.bulletproofs.empty() && rsig.p.rangeSigs.empty() && rsig.p.MGs.empty() && rsig.get_pseudo_outs().empty() && sigs == val.MemberEnd())
|
||||||
|
tx.pruned = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::block& b)
|
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::block& b)
|
||||||
@ -1062,6 +1076,7 @@ void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const rct::rctSig&
|
|||||||
INSERT_INTO_JSON_OBJECT(dest, fee, sig.txnFee);
|
INSERT_INTO_JSON_OBJECT(dest, fee, sig.txnFee);
|
||||||
|
|
||||||
// prunable
|
// prunable
|
||||||
|
if (!sig.p.bulletproofs.empty() || !sig.p.rangeSigs.empty() || !sig.p.MGs.empty() || !sig.get_pseudo_outs().empty())
|
||||||
{
|
{
|
||||||
dest.Key("prunable");
|
dest.Key("prunable");
|
||||||
dest.StartObject();
|
dest.StartObject();
|
||||||
@ -1086,35 +1101,39 @@ void fromJsonValue(const rapidjson::Value& val, rct::rctSig& sig)
|
|||||||
throw WRONG_TYPE("json object");
|
throw WRONG_TYPE("json object");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<rct::key> commitments;
|
|
||||||
|
|
||||||
GET_FROM_JSON_OBJECT(val, sig.type, type);
|
GET_FROM_JSON_OBJECT(val, sig.type, type);
|
||||||
GET_FROM_JSON_OBJECT(val, sig.ecdhInfo, encrypted);
|
GET_FROM_JSON_OBJECT(val, sig.ecdhInfo, encrypted);
|
||||||
GET_FROM_JSON_OBJECT(val, commitments, commitments);
|
GET_FROM_JSON_OBJECT(val, sig.outPk, commitments);
|
||||||
GET_FROM_JSON_OBJECT(val, sig.txnFee, fee);
|
GET_FROM_JSON_OBJECT(val, sig.txnFee, fee);
|
||||||
|
|
||||||
// prunable
|
// prunable
|
||||||
|
const auto prunable = val.FindMember("prunable");
|
||||||
|
if (prunable != val.MemberEnd())
|
||||||
{
|
{
|
||||||
OBJECT_HAS_MEMBER_OR_THROW(val, "prunable");
|
rct::keyV pseudo_outs = std::move(sig.get_pseudo_outs());
|
||||||
const auto& prunable = val["prunable"];
|
|
||||||
|
|
||||||
rct::keyV pseudo_outs;
|
GET_FROM_JSON_OBJECT(prunable->value, sig.p.rangeSigs, range_proofs);
|
||||||
|
GET_FROM_JSON_OBJECT(prunable->value, sig.p.bulletproofs, bulletproofs);
|
||||||
GET_FROM_JSON_OBJECT(prunable, sig.p.rangeSigs, range_proofs);
|
GET_FROM_JSON_OBJECT(prunable->value, sig.p.MGs, mlsags);
|
||||||
GET_FROM_JSON_OBJECT(prunable, sig.p.bulletproofs, bulletproofs);
|
GET_FROM_JSON_OBJECT(prunable->value, pseudo_outs, pseudo_outs);
|
||||||
GET_FROM_JSON_OBJECT(prunable, sig.p.MGs, mlsags);
|
|
||||||
GET_FROM_JSON_OBJECT(prunable, pseudo_outs, pseudo_outs);
|
|
||||||
|
|
||||||
sig.get_pseudo_outs() = std::move(pseudo_outs);
|
sig.get_pseudo_outs() = std::move(pseudo_outs);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
sig.outPk.reserve(commitments.size());
|
|
||||||
for (rct::key const& commitment : commitments)
|
|
||||||
{
|
{
|
||||||
sig.outPk.push_back({{}, commitment});
|
sig.p.rangeSigs.clear();
|
||||||
|
sig.p.bulletproofs.clear();
|
||||||
|
sig.p.MGs.clear();
|
||||||
|
sig.get_pseudo_outs().clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fromJsonValue(const rapidjson::Value& val, rct::ctkey& key)
|
||||||
|
{
|
||||||
|
key.dest = {};
|
||||||
|
fromJsonValue(val, key.mask);
|
||||||
|
}
|
||||||
|
|
||||||
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const rct::ecdhTuple& tuple)
|
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const rct::ecdhTuple& tuple)
|
||||||
{
|
{
|
||||||
dest.StartObject();
|
dest.StartObject();
|
||||||
|
@ -277,6 +277,8 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::rpc::BlockHeaderResp
|
|||||||
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const rct::rctSig& i);
|
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const rct::rctSig& i);
|
||||||
void fromJsonValue(const rapidjson::Value& val, rct::rctSig& sig);
|
void fromJsonValue(const rapidjson::Value& val, rct::rctSig& sig);
|
||||||
|
|
||||||
|
void fromJsonValue(const rapidjson::Value& val, rct::ctkey& key);
|
||||||
|
|
||||||
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const rct::ecdhTuple& tuple);
|
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const rct::ecdhTuple& tuple);
|
||||||
void fromJsonValue(const rapidjson::Value& val, rct::ecdhTuple& tuple);
|
void fromJsonValue(const rapidjson::Value& val, rct::ecdhTuple& tuple);
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ namespace
|
|||||||
: cryptonote::rpc::RpcHandler()
|
: cryptonote::rpc::RpcHandler()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual epee::byte_slice handle(const std::string& request) override final
|
virtual epee::byte_slice handle(std::string&& request) override final
|
||||||
{
|
{
|
||||||
throw std::logic_error{"not implemented"};
|
throw std::logic_error{"not implemented"};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user