working premine; empty first version of PROTOCOL_TX in block

This commit is contained in:
Some Random Crypto Guy
2023-10-18 10:48:16 +01:00
parent d186cf95c1
commit 0b3633ccdc
667 changed files with 8288 additions and 5019 deletions
+104 -41
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2016-2023, The Monero Project
// Copyright (c) 2016-2022, The Monero Project
//
// All rights reserved.
//
@@ -313,7 +313,9 @@ void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::b
INSERT_INTO_JSON_OBJECT(dest, timestamp, b.timestamp);
INSERT_INTO_JSON_OBJECT(dest, prev_id, b.prev_id);
INSERT_INTO_JSON_OBJECT(dest, nonce, b.nonce);
INSERT_INTO_JSON_OBJECT(dest, pricing_record, b.pricing_record);
INSERT_INTO_JSON_OBJECT(dest, miner_tx, b.miner_tx);
INSERT_INTO_JSON_OBJECT(dest, protocol_tx, b.protocol_tx);
INSERT_INTO_JSON_OBJECT(dest, tx_hashes, b.tx_hashes);
dest.EndObject();
@@ -332,7 +334,9 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::block& b)
GET_FROM_JSON_OBJECT(val, b.timestamp, timestamp);
GET_FROM_JSON_OBJECT(val, b.prev_id, prev_id);
GET_FROM_JSON_OBJECT(val, b.nonce, nonce);
GET_FROM_JSON_OBJECT(val, b.pricing_record, pricing_record);
GET_FROM_JSON_OBJECT(val, b.miner_tx, miner_tx);
GET_FROM_JSON_OBJECT(val, b.protocol_tx, protocol_tx);
GET_FROM_JSON_OBJECT(val, b.tx_hashes, tx_hashes);
}
@@ -345,7 +349,7 @@ void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::t
rapidjson::Writer<epee::byte_stream>& dest;
void operator()(cryptonote::txin_fulmo_key const& input) const
void operator()(cryptonote::txin_to_key const& input) const
{
INSERT_INTO_JSON_OBJECT(dest, to_key, input);
}
@@ -383,7 +387,7 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::txin_v& txin)
{
if (elem.name == "to_key")
{
cryptonote::txin_fulmo_key tmpVal;
cryptonote::txin_to_key tmpVal;
fromJsonValue(elem.value, tmpVal);
txin = std::move(tmpVal);
}
@@ -478,19 +482,19 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::txin_to_scripthash&
GET_FROM_JSON_OBJECT(val, txin.sigset, sigset);
}
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::txin_fulmo_key& txin)
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::txin_to_key& txin)
{
dest.StartObject();
INSERT_INTO_JSON_OBJECT(dest, amount, txin.amount);
INSERT_INTO_JSON_OBJECT(dest, asset_type, txin.asset_type);
INSERT_INTO_JSON_OBJECT(dest, key_offsets, txin.key_offsets);
INSERT_INTO_JSON_OBJECT(dest, key_image, txin.k_image);
INSERT_INTO_JSON_OBJECT(dest, asset_type, txin.asset_type);
dest.EndObject();
}
void fromJsonValue(const rapidjson::Value& val, cryptonote::txin_fulmo_key& txin)
void fromJsonValue(const rapidjson::Value& val, cryptonote::txin_to_key& txin)
{
if (!val.IsObject())
{
@@ -498,9 +502,9 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::txin_fulmo_key& txin
}
GET_FROM_JSON_OBJECT(val, txin.amount, amount);
GET_FROM_JSON_OBJECT(val, txin.asset_type, asset_type);
GET_FROM_JSON_OBJECT(val, txin.key_offsets, key_offsets);
GET_FROM_JSON_OBJECT(val, txin.k_image, key_image);
GET_FROM_JSON_OBJECT(val, txin.asset_type, asset_type);
}
@@ -546,19 +550,18 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::txout_to_scripthash&
}
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::txout_fulmo_tagged_key& txout)
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::txout_to_key& txout)
{
dest.StartObject();
INSERT_INTO_JSON_OBJECT(dest, key, txout.key);
INSERT_INTO_JSON_OBJECT(dest, view_tag, txout.view_tag);
INSERT_INTO_JSON_OBJECT(dest, asset_type, txout.asset_type);
INSERT_INTO_JSON_OBJECT(dest, unlock_time, txout.unlock_time);
dest.EndObject();
}
void fromJsonValue(const rapidjson::Value& val, cryptonote::txout_fulmo_tagged_key& txout)
void fromJsonValue(const rapidjson::Value& val, cryptonote::txout_to_key& txout)
{
if (!val.IsObject())
{
@@ -566,11 +569,35 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::txout_fulmo_tagged_k
}
GET_FROM_JSON_OBJECT(val, txout.key, key);
GET_FROM_JSON_OBJECT(val, txout.view_tag, view_tag);
GET_FROM_JSON_OBJECT(val, txout.asset_type, asset_type);
GET_FROM_JSON_OBJECT(val, txout.unlock_time, unlock_time);
}
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, asset_type, txout.asset_type);
INSERT_INTO_JSON_OBJECT(dest, unlock_time, txout.unlock_time);
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.asset_type, asset_type);
GET_FROM_JSON_OBJECT(val, txout.unlock_time, unlock_time);
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();
@@ -582,9 +609,13 @@ void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::t
rapidjson::Writer<epee::byte_stream>& dest;
void operator()(cryptonote::txout_fulmo_tagged_key const& output) const
void operator()(cryptonote::txout_to_key const& output) const
{
INSERT_INTO_JSON_OBJECT(dest, fulmo_tagged_key, output);
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
{
@@ -618,9 +649,15 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::tx_out& txout)
fromJsonValue(elem.value, txout.amount);
}
if (elem.name == "fulmo_tagged_key")
if (elem.name == "to_key")
{
cryptonote::txout_fulmo_tagged_key tmpVal;
cryptonote::txout_to_key tmpVal;
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);
}
@@ -1051,6 +1088,56 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::rpc::error& error)
GET_FROM_JSON_OBJECT(val, error.message, message);
}
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const std::pair<std::string, std::pair<uint64_t, uint64_t>>& pr_entry)
{
dest.StartObject();
INSERT_INTO_JSON_OBJECT(dest, asset_type, pr_entry.first);
INSERT_INTO_JSON_OBJECT(dest, spot, pr_entry.second.first);
INSERT_INTO_JSON_OBJECT(dest, ma, pr_entry.second.second);
dest.EndObject();
}
void fromJsonValue(const rapidjson::Value& val, std::pair<std::string, std::pair<uint64_t, uint64_t>>& pr_entry)
{
if (!val.IsObject())
{
throw WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, boost::lexical_cast<std::string>(pr_entry.first), asset_type);
GET_FROM_JSON_OBJECT(val, pr_entry.second.first, spot);
GET_FROM_JSON_OBJECT(val, pr_entry.second.second, ma);
}
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const oracle::pricing_record& pricing_record)
{
dest.StartObject();
INSERT_INTO_JSON_OBJECT(dest, pr_version, pricing_record.pr_version);
INSERT_INTO_JSON_OBJECT(dest, spot, pricing_record.spot);
INSERT_INTO_JSON_OBJECT(dest, moving_average, pricing_record.moving_average);
INSERT_INTO_JSON_OBJECT(dest, timestamp, pricing_record.timestamp);
INSERT_INTO_JSON_OBJECT(dest, signature, pricing_record.signature);
dest.EndObject();
}
void fromJsonValue(const rapidjson::Value& val, oracle::pricing_record& pricing_record)
{
if (!val.IsObject())
{
throw WRONG_TYPE("json object");
}
GET_FROM_JSON_OBJECT(val, pricing_record.pr_version, pr_version);
GET_FROM_JSON_OBJECT(val, pricing_record.spot, spot);
GET_FROM_JSON_OBJECT(val, pricing_record.moving_average, moving_average);
GET_FROM_JSON_OBJECT(val, pricing_record.timestamp, timestamp);
GET_FROM_JSON_OBJECT(val, boost::lexical_cast<std::string>(pricing_record.signature), signature);
}
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::rpc::BlockHeaderResponse& response)
{
dest.StartObject();
@@ -1060,6 +1147,7 @@ void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::r
INSERT_INTO_JSON_OBJECT(dest, timestamp, response.timestamp);
INSERT_INTO_JSON_OBJECT(dest, prev_id, response.prev_id);
INSERT_INTO_JSON_OBJECT(dest, nonce, response.nonce);
INSERT_INTO_JSON_OBJECT(dest, pricing_record, response.pricing_record);
INSERT_INTO_JSON_OBJECT(dest, height, response.height);
INSERT_INTO_JSON_OBJECT(dest, depth, response.depth);
INSERT_INTO_JSON_OBJECT(dest, hash, response.hash);
@@ -1081,6 +1169,7 @@ void fromJsonValue(const rapidjson::Value& val, cryptonote::rpc::BlockHeaderResp
GET_FROM_JSON_OBJECT(val, response.timestamp, timestamp);
GET_FROM_JSON_OBJECT(val, response.prev_id, prev_id);
GET_FROM_JSON_OBJECT(val, response.nonce, nonce);
GET_FROM_JSON_OBJECT(val, response.pricing_record, pricing_record);
GET_FROM_JSON_OBJECT(val, response.height, height);
GET_FROM_JSON_OBJECT(val, response.depth, depth);
GET_FROM_JSON_OBJECT(val, response.hash, hash);
@@ -1117,7 +1206,6 @@ void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const rct::rctSig&
INSERT_INTO_JSON_OBJECT(dest, bulletproofs, sig.p.bulletproofs);
INSERT_INTO_JSON_OBJECT(dest, bulletproofs_plus, sig.p.bulletproofs_plus);
INSERT_INTO_JSON_OBJECT(dest, mlsags, sig.p.MGs);
INSERT_INTO_JSON_OBJECT(dest, clsags, sig.p.CLSAGs);
INSERT_INTO_JSON_OBJECT(dest, pseudo_outs, sig.get_pseudo_outs());
dest.EndObject();
@@ -1153,7 +1241,6 @@ void fromJsonValue(const rapidjson::Value& val, rct::rctSig& sig)
GET_FROM_JSON_OBJECT(prunable->value, sig.p.bulletproofs, bulletproofs);
GET_FROM_JSON_OBJECT(prunable->value, sig.p.bulletproofs_plus, bulletproofs_plus);
GET_FROM_JSON_OBJECT(prunable->value, sig.p.MGs, mlsags);
GET_FROM_JSON_OBJECT(prunable->value, sig.p.CLSAGs, clsags);
GET_FROM_JSON_OBJECT(prunable->value, pseudo_outs, pseudo_outs);
sig.get_pseudo_outs() = std::move(pseudo_outs);
@@ -1164,7 +1251,6 @@ void fromJsonValue(const rapidjson::Value& val, rct::rctSig& sig)
sig.p.bulletproofs.clear();
sig.p.bulletproofs_plus.clear();
sig.p.MGs.clear();
sig.p.CLSAGs.clear();
sig.get_pseudo_outs().clear();
}
}
@@ -1373,29 +1459,6 @@ void fromJsonValue(const rapidjson::Value& val, rct::mgSig& sig)
GET_FROM_JSON_OBJECT(val, sig.cc, cc);
}
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const rct::clsag& sig)
{
dest.StartObject();
INSERT_INTO_JSON_OBJECT(dest, s, sig.s);
INSERT_INTO_JSON_OBJECT(dest, c1, sig.c1);
INSERT_INTO_JSON_OBJECT(dest, D, sig.D);
dest.EndObject();
}
void fromJsonValue(const rapidjson::Value& val, rct::clsag& sig)
{
if (!val.IsObject())
{
throw WRONG_TYPE("key64 (rct::key[64])");
}
GET_FROM_JSON_OBJECT(val, sig.s, s);
GET_FROM_JSON_OBJECT(val, sig.c1, c1);
GET_FROM_JSON_OBJECT(val, sig.D, D);
}
void toJsonValue(rapidjson::Writer<epee::byte_stream>& dest, const cryptonote::rpc::DaemonInfo& info)
{
dest.StartObject();