33#include <boost/variant.hpp>
34#include <boost/functional/hash/hash.hpp>
63 std::vector<crypto::public_key>
keys;
231 void invalidate_hashes();
232 bool is_hash_valid()
const {
return hash_valid.load(std::memory_order_acquire); }
233 void set_hash_valid(
bool v)
const { hash_valid.store(v,std::memory_order_release); }
240 void set_blob_size(
size_t sz)
const { blob_size = sz; set_blob_size_valid(
true); }
243 if (!typename Archive<W>::is_saving())
245 set_hash_valid(
false);
246 set_prunable_hash_valid(
false);
247 set_blob_size_valid(
false);
255 prefix_size =
ar.getpos() - start_pos;
260 unprunable_size =
ar.
getpos() - start_pos;
262 ar.
tag(
"signatures");
265 bool signatures_not_expected = signatures.empty();
266 if (!signatures_not_expected && vin.size() != signatures.size())
269 if (!pruned)
for (
size_t i = 0; i < vin.size(); ++i)
271 size_t signature_size = get_signature_size(vin[i]);
272 if (signatures_not_expected)
274 if (0 == signature_size)
281 if (signature_size != signatures[i].size())
286 if (vin.size() - i > 1)
293 ar.
tag(
"rct_signatures");
298 if (!r || !
ar.
good())
return false;
302 unprunable_size =
ar.
getpos() - start_pos;
306 ar.
tag(
"rctsig_prunable");
309 vin.size() > 0 && vin[0].type() ==
typeid(
txin_to_key) ? boost::get<txin_to_key>(vin[0]).key_offsets.size() - 1 : 0);
310 if (!r || !
ar.
good())
return false;
315 if (!
typename Archive<W>::is_saving())
319 template<
bool W, template <
bool> class Archive>
320 bool serialize_base(Archive<W> &
ar)
329 ar.
tag(
"rct_signatures");
334 if (!r || !
ar.
good())
return false;
338 if (!
typename Archive<W>::is_saving())
344 static size_t get_signature_size(
const txin_v& tx_in);
350 prunable_hash_valid(
false),
351 blob_size_valid(
false),
352 signatures(t.signatures),
353 rct_signatures(t.rct_signatures),
355 unprunable_size(t.unprunable_size.load()),
356 prefix_size(t.prefix_size.load())
358 if (t.is_hash_valid())
363 if (t.is_blob_size_valid())
368 if (t.is_prunable_hash_valid())
377 transaction_prefix::operator=(t);
384 if (t.is_hash_valid())
389 if (t.is_prunable_hash_valid())
394 if (t.is_blob_size_valid())
441 struct txin_signature_size_visitor :
public boost::static_visitor<size_t>
443 size_t operator()(
const txin_gen& txin)
const{
return 0;}
449 return boost::apply_visitor(txin_signature_size_visitor(), tx_in);
485 bool is_hash_valid()
const {
return hash_valid.load(std::memory_order_acquire); }
486 void set_hash_valid(
bool v)
const { hash_valid.store(v,std::memory_order_release); }
496 if (!typename Archive<W>::is_saving())
497 set_hash_valid(
false);
517 FIELD(m_spend_public_key)
518 FIELD(m_view_public_key)
528 return m_spend_public_key == rhs.m_spend_public_key &&
529 m_view_public_key == rhs.m_view_public_key;
534 return !(*
this == rhs);
cryptonote::block b
Definition block.cpp:40
static uint64_t h
Definition blockchain_stats.cpp:55
Definition cryptonote_basic.h:171
std::vector< uint8_t > extra
Definition cryptonote_basic.h:181
std::vector< txin_v > vin
Definition cryptonote_basic.h:178
size_t version
Definition cryptonote_basic.h:175
void set_null()
Definition cryptonote_basic.h:194
std::vector< tx_out > vout
Definition cryptonote_basic.h:179
uint64_t unlock_time
Definition cryptonote_basic.h:176
Definition cryptonote_basic.h:205
bool is_hash_valid() const
Definition cryptonote_basic.h:232
bool is_prunable_hash_valid() const
Definition cryptonote_basic.h:234
rct::rctSig rct_signatures
Definition cryptonote_basic.h:214
std::atomic< bool > blob_size_valid
Definition cryptonote_basic.h:210
void set_null()
Definition cryptonote_basic.h:417
transaction()
Definition cryptonote_basic.h:406
void set_blob_size(size_t sz) const
Definition cryptonote_basic.h:240
std::atomic< unsigned int > unprunable_size
Definition cryptonote_basic.h:223
void set_prunable_hash(const crypto::hash &h) const
Definition cryptonote_basic.h:239
std::atomic< unsigned int > prefix_size
Definition cryptonote_basic.h:224
bool pruned
Definition cryptonote_basic.h:221
void set_hash(const crypto::hash &h) const
Definition cryptonote_basic.h:238
void set_hash_valid(bool v) const
Definition cryptonote_basic.h:233
static size_t get_signature_size(const txin_v &tx_in)
Definition cryptonote_basic.h:439
void set_prunable_hash_valid(bool v) const
Definition cryptonote_basic.h:235
transaction & operator=(const transaction &t)
Definition cryptonote_basic.h:375
std::atomic< bool > prunable_hash_valid
Definition cryptonote_basic.h:209
crypto::hash prunable_hash
Definition cryptonote_basic.h:218
std::vector< std::vector< crypto::signature > > signatures
Definition cryptonote_basic.h:213
void invalidate_hashes()
Definition cryptonote_basic.h:431
virtual ~transaction()
Definition cryptonote_basic.h:412
size_t blob_size
Definition cryptonote_basic.h:219
void set_blob_size_valid(bool v) const
Definition cryptonote_basic.h:237
crypto::hash hash
Definition cryptonote_basic.h:217
bool is_blob_size_valid() const
Definition cryptonote_basic.h:236
std::atomic< bool > hash_valid
Definition cryptonote_basic.h:208
virtual crypto::secret_key generate_keys(crypto::public_key &pub, crypto::secret_key &sec, const crypto::secret_key &recovery_key=crypto::secret_key(), bool recover=false)=0
binary_archive< false > ar
Definition cold-outputs.cpp:54
#define CRYPTONOTE_MAX_TX_PER_BLOCK
Definition cryptonote_config.h:42
#define CURRENT_TRANSACTION_VERSION
Definition cryptonote_config.h:45
const char * res
Definition hmac_keccak.cpp:42
const char * key
Definition hmac_keccak.cpp:40
#define const
Definition ipfrdr.c:80
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(varialble)
Definition keyvalue_serialization.h:123
#define END_KV_SERIALIZE_MAP()
Definition keyvalue_serialization.h:118
#define BEGIN_KV_SERIALIZE_MAP()
Definition keyvalue_serialization.h:43
static int version
Definition mdb_load.c:29
Definition portable_binary_archive.hpp:29
POD_CLASS view_tag
Definition crypto.h:103
POD_CLASS public_key
Definition crypto.h:64
POD_CLASS key_image
Definition crypto.h:95
POD_CLASS hash
Definition hash.h:49
Holds cryptonote related classes and helpers.
Definition blockchain_db.cpp:45
boost::variant< txout_to_script, txout_to_scripthash, txout_to_key, txout_to_tagged_key > txout_target_v
Definition cryptonote_basic.h:154
boost::variant< txin_gen, txin_to_script, txin_to_scripthash, txin_to_key > txin_v
Definition cryptonote_basic.h:152
std::vector< crypto::signature > ring_signature
Definition cryptonote_basic.h:56
@ RCTTypeNull
Definition rctTypes.h:299
#define BEGIN_SERIALIZE()
Begins the environment of the DSL \detailed for describing how to serialize an of an archive type.
Definition serialization.h:122
#define BEGIN_SERIALIZE_OBJECT()
begins the environment of the DSL \detailed for described the serialization of an object
Definition serialization.h:131
#define BLOB_SERIALIZER(T)
makes the type have a blob serializer trait defined
Definition serialization.h:98
#define FIELD(f)
tags the field with the variable name and then serializes it
Definition serialization.h:169
#define PREPARE_CUSTOM_VECTOR_SERIALIZATION(size, vec)
Definition serialization.h:144
#define FIELDS(f)
does not add a tag to the serialized value
Definition serialization.h:180
#define END_SERIALIZE()
self-explanatory
Definition serialization.h:150
#define VARIANT_TAG(Archive, Type, Tag)
Adds the tag \tag to the Archive of Type.
Definition serialization.h:108
#define VARINT_FIELD(f)
tags and serializes the varint f
Definition serialization.h:189
if(!cryptonote::get_account_address_from_str_or_url(info, cryptonote::TESTNET, "9uVsvEryzpN8WH2t1WWhFFCG5tS8cBNdmJYNRuckLENFimfauV5pZKeS1P2CbxGkSDTUPHXWwiYE5ZGSXDAGbaZgDxobqDN"))
Definition signature.cpp:53
#define false
Definition stdbool.h:37
unsigned int uint32_t
Definition stdint.h:126
unsigned char uint8_t
Definition stdint.h:124
bool good() const noexcept
Definition binary_archive.h:99
void begin_array(size_t &s)
Definition binary_archive.h:153
void delimit_array()
Definition binary_archive.h:159
void end_array()
Definition binary_archive.h:160
std::size_t getpos() const noexcept
Definition binary_archive.h:104
void begin_object()
Definition binary_archive.h:72
void end_object()
Definition binary_archive.h:73
void tag(const char *)
Definition binary_archive.h:71
Definition binary_archive.h:89
Definition cryptonote_basic.h:512
crypto::public_key m_view_public_key
Definition cryptonote_basic.h:514
bool operator!=(const account_public_address &rhs) const
Definition cryptonote_basic.h:532
crypto::public_key m_spend_public_key
Definition cryptonote_basic.h:513
Definition cryptonote_basic.h:475
transaction miner_tx
Definition cryptonote_basic.h:489
void set_hash(const crypto::hash &h) const
Definition cryptonote_basic.h:487
void invalidate_hashes()
Definition cryptonote_basic.h:484
block()
Definition cryptonote_basic.h:481
crypto::hash hash
Definition cryptonote_basic.h:493
block & operator=(const block &b)
Definition cryptonote_basic.h:483
bool is_hash_valid() const
Definition cryptonote_basic.h:485
void set_hash_valid(bool v) const
Definition cryptonote_basic.h:486
block(const block &b)
Definition cryptonote_basic.h:482
std::vector< crypto::hash > tx_hashes
Definition cryptonote_basic.h:490
std::atomic< bool > hash_valid
Definition cryptonote_basic.h:478
Definition cryptonote_basic.h:539
crypto::secret_key sec
Definition cryptonote_basic.h:541
static keypair generate(hw::device &hwdev)
Definition cryptonote_basic.h:543
crypto::public_key pub
Definition cryptonote_basic.h:540
Definition cryptonote_basic.h:158
txout_target_v target
Definition cryptonote_basic.h:160
uint64_t amount
Definition cryptonote_basic.h:159
Definition cryptonote_basic.h:102
size_t height
Definition cryptonote_basic.h:103
Definition cryptonote_basic.h:139
crypto::key_image k_image
Definition cryptonote_basic.h:142
std::vector< uint64_t > key_offsets
Definition cryptonote_basic.h:141
uint64_t amount
Definition cryptonote_basic.h:140
Definition cryptonote_basic.h:111
crypto::hash prev
Definition cryptonote_basic.h:112
std::vector< uint8_t > sigset
Definition cryptonote_basic.h:114
size_t prevout
Definition cryptonote_basic.h:113
Definition cryptonote_basic.h:124
size_t prevout
Definition cryptonote_basic.h:126
std::vector< uint8_t > sigset
Definition cryptonote_basic.h:128
txout_to_script script
Definition cryptonote_basic.h:127
crypto::hash prev
Definition cryptonote_basic.h:125
Definition cryptonote_basic.h:79
crypto::public_key key
Definition cryptonote_basic.h:82
txout_to_key()
Definition cryptonote_basic.h:80
txout_to_key(const crypto::public_key &_key)
Definition cryptonote_basic.h:81
Definition cryptonote_basic.h:62
std::vector< crypto::public_key > keys
Definition cryptonote_basic.h:63
std::vector< uint8_t > script
Definition cryptonote_basic.h:64
Definition cryptonote_basic.h:73
crypto::hash hash
Definition cryptonote_basic.h:74
Definition cryptonote_basic.h:87
txout_to_tagged_key(const crypto::public_key &_key, const crypto::view_tag &_view_tag)
Definition cryptonote_basic.h:89
txout_to_tagged_key()
Definition cryptonote_basic.h:88
crypto::public_key key
Definition cryptonote_basic.h:90
crypto::view_tag view_tag
Definition cryptonote_basic.h:91
Definition debug_archive.h:37
a archive using the JSON standard
Definition json_archive.h:116
uint8_t type
Definition rctTypes.h:319
bool serialize_rctsig_base(Archive< W > &ar, size_t inputs, size_t outputs)
Definition rctTypes.h:333
bool serialize_rctsig_prunable(Archive< W > &ar, uint8_t type, size_t inputs, size_t outputs, size_t mixin)
Definition rctTypes.h:426
Definition rctTypes.h:613
rctSigPrunable p
Definition rctTypes.h:614
std::size_t operator()(const cryptonote::account_public_address &addr) const
Definition cryptonote_basic.h:558
for dealing with variants