Go to the documentation of this file.
33 #include <boost/variant.hpp>
34 #include <boost/functional/hash/hash.hpp>
45 #include "serialization/keyvalue_serialization.h"
49 #include "misc_language.h"
62 std::vector<crypto::public_key>
keys;
220 void invalidate_hashes();
221 bool is_hash_valid()
const {
return hash_valid.load(std::memory_order_acquire); }
222 void set_hash_valid(
bool v)
const { hash_valid.store(v,std::memory_order_release); }
229 void set_blob_size(
size_t sz)
const { blob_size = sz; set_blob_size_valid(
true); }
232 if (!typename Archive<W>::is_saving())
234 set_hash_valid(
false);
235 set_prunable_hash_valid(
false);
236 set_blob_size_valid(
false);
239 const unsigned int start_pos =
getpos(ar);
244 prefix_size =
getpos(ar) - start_pos;
249 unprunable_size =
getpos(ar) - start_pos;
251 ar.tag(
"signatures");
254 bool signatures_not_expected = signatures.empty();
255 if (!signatures_not_expected && vin.size() != signatures.size())
258 if (!pruned)
for (
size_t i = 0; i < vin.size(); ++i)
260 size_t signature_size = get_signature_size(vin[i]);
261 if (signatures_not_expected)
263 if (0 == signature_size)
270 if (signature_size != signatures[i].size())
275 if (vin.size() - i > 1)
282 ar.tag(
"rct_signatures");
287 if (!r || !ar.stream().good())
return false;
291 unprunable_size =
getpos(ar) - start_pos;
295 ar.tag(
"rctsig_prunable");
298 vin.size() > 0 && vin[0].type() ==
typeid(
txin_to_key) ? boost::get<txin_to_key>(vin[0]).key_offsets.size() - 1 : 0);
299 if (!r || !ar.stream().good())
return false;
304 if (!
typename Archive<W>::is_saving())
308 template<
bool W, template <
bool> class Archive>
309 bool serialize_base(Archive<W> &ar)
318 ar.tag(
"rct_signatures");
323 if (!r || !ar.stream().good())
return false;
327 if (!
typename Archive<W>::is_saving())
329 return ar.stream().good();
333 static size_t get_signature_size(
const txin_v& tx_in);
339 prunable_hash_valid(
false),
340 blob_size_valid(
false),
341 signatures(t.signatures),
342 rct_signatures(t.rct_signatures),
344 unprunable_size(t.unprunable_size.
load()),
345 prefix_size(t.prefix_size.
load())
366 transaction_prefix::operator=(t);
430 struct txin_signature_size_visitor :
public boost::static_visitor<size_t>
432 size_t operator()(
const txin_gen& txin)
const{
return 0;}
438 return boost::apply_visitor(txin_signature_size_visitor(), tx_in);
472 block &
operator=(
const block &
b) { block_header::operator=(
b); hash_valid =
false; miner_tx =
b.miner_tx; tx_hashes =
b.tx_hashes;
if (
b.is_hash_valid()) {
hash =
b.hash; set_hash_valid(
true); }
return *
this; }
474 bool is_hash_valid()
const {
return hash_valid.load(std::memory_order_acquire); }
475 void set_hash_valid(
bool v)
const { hash_valid.store(v,std::memory_order_release); }
485 if (!typename Archive<W>::is_saving())
486 set_hash_valid(
false);
506 FIELD(m_spend_public_key)
507 FIELD(m_view_public_key)
510 BEGIN_KV_SERIALIZE_MAP()
511 KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(m_spend_public_key)
512 KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(m_view_public_key)
513 END_KV_SERIALIZE_MAP()
517 return m_spend_public_key == rhs.m_spend_public_key &&
518 m_view_public_key == rhs.m_view_public_key;
523 return !(*
this == rhs);
void set_hash(const crypto::hash &h) const
Definition: cryptonote_basic.h:476
std::vector< tx_out > vout
Definition: cryptonote_basic.h:168
void set_blob_size(size_t sz) const
Definition: cryptonote_basic.h:229
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
crypto::hash prev
Definition: cryptonote_basic.h:97
rctSigPrunable p
Definition: rctTypes.h:537
crypto::secret_key sec
Definition: cryptonote_basic.h:530
uint64_t unlock_time
Definition: cryptonote_basic.h:165
BLOB_SERIALIZER(cryptonote::txout_to_key)
crypto::public_key m_view_public_key
Definition: cryptonote_basic.h:503
transaction miner_tx
Definition: cryptonote_basic.h:478
crypto::hash hash
Definition: cryptonote_basic.h:206
void set_hash_valid(bool v) const
Definition: cryptonote_basic.h:222
boost::variant< txout_to_script, txout_to_scripthash, txout_to_key > txout_target_v
Definition: cryptonote_basic.h:139
crypto::hash hash
Definition: cryptonote_basic.h:73
txout_target_v target
Definition: cryptonote_basic.h:145
std::vector< crypto::public_key > keys
Definition: cryptonote_basic.h:62
const uint32_t T[512]
Definition: groestl_tables.h:36
stream_type & stream()
Definition: binary_archive.h:77
std::atomic< unsigned int > prefix_size
Definition: cryptonote_basic.h:213
Definition: cryptonote_basic.h:143
Definition: cryptonote_basic.h:109
Definition: binary_archive.h:99
std::size_t operator()(const cryptonote::account_public_address &addr) const
Definition: cryptonote_basic.h:547
txout_to_key(const crypto::public_key &_key)
Definition: cryptonote_basic.h:79
std::vector< crypto::hash > tx_hashes
Definition: cryptonote_basic.h:479
void set_prunable_hash_valid(bool v) const
Definition: cryptonote_basic.h:224
bool serialize_rctsig_prunable(Archive< W > &ar, uint8_t type, size_t inputs, size_t outputs, size_t mixin)
Definition: rctTypes.h:369
crypto::hash prunable_hash
Definition: cryptonote_basic.h:207
size_t prevout
Definition: cryptonote_basic.h:111
size_t height
Definition: cryptonote_basic.h:88
std::vector< uint64_t > key_offsets
Definition: cryptonote_basic.h:126
Definition: unordered_containers_boost_serialization.h:38
#define END_SERIALIZE()
self-explanatory
Definition: serialization.h:215
void set_null()
Definition: cryptonote_basic.h:406
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition: crypto.h:67
void set_prunable_hash(const crypto::hash &h) const
Definition: cryptonote_basic.h:228
bool is_prunable_hash_valid() const
Definition: cryptonote_basic.h:223
const
Definition: build_protob.py:9
std::vector< txin_v > vin
Definition: cryptonote_basic.h:167
block & operator=(const block &b)
Definition: cryptonote_basic.h:472
std::vector< uint8_t > extra
Definition: cryptonote_basic.h:170
uint64_t amount
Definition: cryptonote_basic.h:125
bool serialize_rctsig_base(Archive< W > &ar, size_t inputs, size_t outputs)
Definition: rctTypes.h:283
transaction()
Definition: cryptonote_basic.h:395
if(APPLE) if(DEPENDS) list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework ApplicationServices -framework AppKit -framework IOKit") else() find_library(IOKIT_LIBRARY IOKit) mark_as_advanced(IOKIT_LIBRARY) list(APPEND EXTRA_LIBRARIES $
Definition: CMakeLists.txt:29
int b
Definition: base.py:1
Definition: binary_archive.h:94
boost::variant< txin_gen, txin_to_script, txin_to_scripthash, txin_to_key > txin_v
Definition: cryptonote_basic.h:137
void set_null()
Definition: cryptonote_basic.h:183
crypto::key_image k_image
Definition: cryptonote_basic.h:127
#define CRYPTONOTE_MAX_TX_PER_BLOCK
Definition: cryptonote_config.h:41
@ RCTTypeNull
Definition: rctTypes.h:254
std::atomic< unsigned int > unprunable_size
Definition: cryptonote_basic.h:212
Definition: cryptonote_basic.h:160
static keypair generate(hw::device &hwdev)
Definition: cryptonote_basic.h:532
std::atomic< bool > hash_valid
Definition: cryptonote_basic.h:197
#define FIELDS(f)
does not add a tag to the serialized value
Definition: serialization.h:255
void invalidate_hashes()
Definition: cryptonote_basic.h:473
Definition: cryptonote_basic.h:528
std::vector< uint8_t > script
Definition: cryptonote_basic.h:63
std::vector< crypto::signature > ring_signature
Definition: cryptonote_basic.h:55
Definition: cryptonote_basic.h:96
#define BEGIN_SERIALIZE_OBJECT()
begins the environment of the DSL \detailed for described the serialization of an object
Definition: serialization.h:191
Definition: cryptonote_basic.h:464
version
Supported socks variants.
Definition: socks.h:58
VARIANT_TAG(binary_archive, cryptonote::txin_gen, 0xff)
Definition: cryptonote_basic.h:124
size_t prevout
Definition: cryptonote_basic.h:98
crypto::hash hash
Definition: cryptonote_basic.h:482
Definition: device.hpp:87
Holds cryptonote related classes and helpers.
Definition: blockchain_db.cpp:45
static size_t get_signature_size(const txin_v &tx_in)
Definition: cryptonote_basic.h:428
#define VARINT_FIELD(f)
tags and serializes the varint f
Definition: serialization.h:264
bool operator!=(const account_public_address &rhs) const
Definition: cryptonote_basic.h:521
#define inline
Definition: inline_c.h:34
size_t blob_size
Definition: cryptonote_basic.h:208
a archive using the JSON standard
Definition: json_archive.h:111
#define CURRENT_TRANSACTION_VERSION
Definition: cryptonote_config.h:44
#define false
Definition: stdbool.h:37
std::atomic< bool > hash_valid
Definition: cryptonote_basic.h:467
bool is_hash_valid() const
Definition: cryptonote_basic.h:474
for dealing with variants
virtual ~transaction()
Definition: cryptonote_basic.h:401
size_t version
Definition: cryptonote_basic.h:164
Definition: rctTypes.h:536
txout_to_script script
Definition: cryptonote_basic.h:112
Definition: cryptonote_basic.h:87
std::atomic< bool > prunable_hash_valid
Definition: cryptonote_basic.h:198
crypto::hash prev
Definition: cryptonote_basic.h:110
bool is_blob_size_valid() const
Definition: cryptonote_basic.h:225
POD_CLASS public_key
Definition: crypto.h:61
Definition: cryptonote_basic.h:77
crypto::public_key key
Definition: cryptonote_basic.h:80
uint8_t type
Definition: rctTypes.h:273
Definition: blockchain_ancestry.cpp:72
transaction & operator=(const transaction &t)
Definition: cryptonote_basic.h:364
Definition: debug_archive.h:37
Definition: cryptonote_basic.h:501
std::vector< uint8_t > sigset
Definition: cryptonote_basic.h:113
#define PREPARE_CUSTOM_VECTOR_SERIALIZATION(size, vec)
Definition: serialization.h:204
rct::rctSig rct_signatures
Definition: cryptonote_basic.h:203
Definition: binary_archive.h:182
Definition: cryptonote_basic.h:194
void invalidate_hashes()
Definition: cryptonote_basic.h:420
#define FIELD(f)
tags the field with the variable name and then serializes it
Definition: serialization.h:244
#define BEGIN_SERIALIZE()
Begins the environment of the DSL \detailed for describing how to serialize an of an archive type.
Definition: serialization.h:182
Definition: cryptonote_basic.h:61
block(const block &b)
Definition: cryptonote_basic.h:471
txout_to_key()
Definition: cryptonote_basic.h:78
void set_hash_valid(bool v) const
Definition: cryptonote_basic.h:475
POD_CLASS key_image
Definition: crypto.h:87
std::atomic< bool > blob_size_valid
Definition: cryptonote_basic.h:199
void set_hash(const crypto::hash &h) const
Definition: cryptonote_basic.h:227
block()
Definition: cryptonote_basic.h:470
void load(Archive &a, std::unordered_map< h_key, hval > &x, const boost::serialization::version_type ver)
Definition: unordered_containers_boost_serialization.h:54
crypto::public_key pub
Definition: cryptonote_basic.h:529
bool pruned
Definition: cryptonote_basic.h:210
std::vector< uint8_t > sigset
Definition: cryptonote_basic.h:99
uint64_t amount
Definition: cryptonote_basic.h:144
bool is_hash_valid() const
Definition: cryptonote_basic.h:221
std::vector< std::vector< crypto::signature > > signatures
Definition: cryptonote_basic.h:202
static unsigned int getpos(T &ar)
Definition: cryptonote_basic.h:155
void set_blob_size_valid(bool v) const
Definition: cryptonote_basic.h:226
Definition: cryptonote_basic.h:72
POD_CLASS hash
Definition: hash.h:48
crypto::public_key m_spend_public_key
Definition: cryptonote_basic.h:502