1
0
Fork 0
forked from lthn/blockchain

added BEGIN_BOOST_SERIALIZATION macros

This commit is contained in:
cryptozoidberg 2022-05-09 20:28:13 +02:00
parent 116011fdcf
commit c53da67e1a
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
6 changed files with 38 additions and 1 deletions

View file

@ -16,6 +16,7 @@
#define CHECK_PROJECT_NAME() std::string project_name = CURRENCY_NAME; ar & project_name; if(!(project_name == CURRENCY_NAME) ) {throw std::runtime_error(std::string("wrong storage file: project name in file: ") + project_name + ", expected: " + CURRENCY_NAME );}
namespace tools
{
template<class t_object>

View file

@ -0,0 +1,32 @@
// Copyright (c) 2014-2022 Zano Project
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#pragma once
#define BEGIN_BOOST_SERIALIZATION() template <class t_archive> inline void serialize(t_archive &_arch, const unsigned int ver) {
#define BOOST_SERIALIZE(x) _arch & x;
#define END_BOOST_SERIALIZATION() }
/*
example of use:
struct tx_extra_info
{
crypto::public_key m_tx_pub_key;
extra_alias_entry m_alias;
std::string m_user_data_blob;
extra_attachment_info m_attachment_info;
BEGIN_BOOST_SERIALIZATION()
BOOST_SERIALIZE(m_tx_pub_key)
BOOST_SERIALIZE(m_alias)
if(ver < xxx) return;
BOOST_SERIALIZE(m_user_data_blob)
BOOST_SERIALIZE(m_attachment_info)
END_BOOST_SERIALIZATION()
};
*/

View file

@ -602,7 +602,7 @@ namespace currency
//extra
std::vector<extra_v> extra;
std::vector<txin_v> vin;
std::vector<tx_out> vout;
std::vector<tx_out_v> vout_;//std::vector<tx_out> vout;
BEGIN_SERIALIZE()
VARINT_FIELD(version)

View file

@ -27,6 +27,7 @@
#define CURRENCY_PUBLIC_AUDITABLE_INTEG_ADDRESS_BASE58_PREFIX 0x8a49 // auditable integrated addresses start with 'aiZX'
#define CURRENCY_MINED_MONEY_UNLOCK_WINDOW 10
#define CURRENT_TRANSACTION_VERSION 1
#define CURRENT_TRANSACTION_VERSION_HF4 2
#define HF1_BLOCK_MAJOR_VERSION 1
#define CURRENT_BLOCK_MAJOR_VERSION 2

View file

@ -156,6 +156,7 @@ namespace currency
std::vector<currency::tx_destination_entry> prepared_destinations;
uint64_t expiration_time;
crypto::public_key spend_pub_key; // only for validations
uint64_t tx_version;
BEGIN_SERIALIZE_OBJECT()
FIELD(unlock_time)
@ -171,6 +172,7 @@ namespace currency
FIELD(prepared_destinations)
FIELD(expiration_time)
FIELD(spend_pub_key)
FIELD(tx_version)
END_SERIALIZE()
};

View file

@ -697,6 +697,7 @@ namespace tools
uint64_t get_top_block_height() const { return m_chain.get_top_block_height(); }
template <class t_archive>
inline void serialize(t_archive &a, const unsigned int ver)
{