34 #include <boost/variant.hpp>
35 #include <boost/functional/hash/hash.hpp>
91 return !(*
this == rhs);
99 std::vector<crypto::public_key>
keys;
131 std::stringstream ss;
141 ar.serialize_string(etn_address);
142 if (!ar.stream().good())
235 template<typename
T> static
inline unsigned int getpos(
T &ar) {
return 0; }
295 mutable std::atomic<bool> hash_valid;
296 mutable std::atomic<bool> blob_size_valid;
316 void invalidate_hashes();
317 bool is_hash_valid()
const {
return hash_valid.load(std::memory_order_acquire); }
318 void set_hash_valid(
bool v)
const { hash_valid.store(v,std::memory_order_release); }
322 void set_blob_size(
size_t sz) { blob_size = sz; set_blob_size_valid(
true); }
325 if (!typename Archive<W>::is_saving())
327 set_hash_valid(
false);
328 set_blob_size_valid(
false);
331 const unsigned int start_pos = getpos(ar);
337 prefix_size = getpos(ar) - start_pos;
338 unprunable_size = getpos(ar) - start_pos;
341 ar.tag(
"signatures");
344 bool signatures_not_expected = signatures.empty();
345 if (!signatures_not_expected && vin.size() != signatures.size())
348 if (!pruned)
for (
size_t i = 0; i < vin.size(); ++i)
350 size_t signature_size = get_signature_size(vin[i]);
351 if (signatures_not_expected)
353 if (0 == signature_size)
360 if (signature_size != signatures[i].size())
365 if (vin.size() - i > 1)
370 if (!
typename Archive<W>::is_saving())
374 template<
bool W, template <
bool> class Archive>
375 bool serialize_base(Archive<W> &ar)
379 if (!typename Archive<W>::is_saving())
381 return ar.stream().good();
385 static
size_t get_signature_size(const
txin_v& tx_in);
406 set_hash_valid(
false);
407 set_blob_size_valid(
false);
416 set_hash_valid(
false);
417 set_blob_size_valid(
false);
421 size_t transaction::get_signature_size(
const txin_v& tx_in)
423 struct txin_signature_size_visitor :
public boost::static_visitor<size_t>
425 size_t operator()(
const txin_gen& txin)
const{
return 0;}
426 size_t operator()(
const txin_to_script& txin)
const{
return 0;}
427 size_t operator()(
const txin_to_scripthash& txin)
const{
return 0;}
428 size_t operator()(
const txin_to_key& txin)
const {
return txin.key_offsets.size();}
429 size_t operator()(
const txin_to_key_public& txin)
const {
return 1;}
432 return boost::apply_visitor(txin_signature_size_visitor(), tx_in);
461 mutable std::atomic<bool> hash_valid;
468 bool is_hash_valid()
const {
return hash_valid.load(std::memory_order_acquire); }
469 void set_hash_valid(
bool v)
const { hash_valid.store(v,std::memory_order_release); }
481 if (!typename Archive<W>::is_saving())
482 set_hash_valid(
false);
connection< TProtocol > & operator=(const connection< TProtocol > &obj)
void set_null_besides_version()
std::vector< uint8_t > extra
std::vector< txin_v > vin
std::vector< tx_out > vout
bool is_hash_valid() const
rct::rctSig rct_signatures
transaction & operator=(const transaction &t)
void set_hash(const crypto::hash &h)
std::atomic< unsigned int > unprunable_size
std::atomic< unsigned int > prefix_size
void set_blob_size(size_t sz)
void set_hash_valid(bool v) const
transaction(const transaction &t)
PREPARE_CUSTOM_VECTOR_SERIALIZATION(vin.size(), signatures)
std::vector< std::vector< crypto::signature > > signatures
void set_blob_size_valid(bool v) const
bool is_blob_size_valid() const
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
VARIANT_TAG(binary_archive, cryptonote::txin_gen, 0xff)
BLOB_SERIALIZER(cryptonote::txout_to_key)
#define CRYPTONOTE_MAX_TX_PER_BLOCK
#define CURRENT_TRANSACTION_VERSION
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(varialble)
#define END_KV_SERIALIZE_MAP()
#define BEGIN_KV_SERIALIZE_MAP()
void load(Archive &a, std::unordered_map< h_key, hval > &x, const boost::serialization::version_type ver)
Holds cryptonote related classes and helpers.
boost::variant< txin_gen, txin_to_script, txin_to_scripthash, txin_to_key, txin_to_key_public > txin_v
std::vector< crypto::signature > ring_signature
boost::variant< txout_to_script, txout_to_scripthash, txout_to_key, txout_to_key_public > txout_target_v
version
Supported socks variants.
void serialize(Archive &a, unsigned_tx_set &x, const boost::serialization::version_type ver)
#define BEGIN_SERIALIZE()
Begins the environment of the DSL \detailed for describing how to serialize an of an archive type.
#define BEGIN_SERIALIZE_OBJECT()
begins the environment of the DSL \detailed for described the serialization of an object
#define FIELD(f)
tags the field with the variable name and then serializes it
#define PREPARE_CUSTOM_VECTOR_SERIALIZATION(size, vec)
#define FIELDS(f)
does not add a tag to the serialized value
#define END_SERIALIZE()
self-explanatory
#define VARINT_FIELD(f)
tags and serializes the varint f
unsigned __int64 uint64_t
crypto::public_key m_view_public_key
bool operator!=(const account_public_address &rhs) const
crypto::public_key m_spend_public_key
uint64_t relative_out_index
std::vector< uint8_t > signature
bool is_hash_valid() const
void set_hash_valid(bool v) const
std::vector< uint8_t > signatory
std::vector< crypto::hash > tx_hashes
block & operator=(const block &b)
static keypair generate(hw::device &hwdev)
crypto::key_image k_image
std::vector< uint64_t > key_offsets
std::vector< uint8_t > sigset
std::vector< uint8_t > sigset
uint64_t m_address_prefix
cryptonote::account_public_address address
txout_to_key(const crypto::public_key &_key)
std::vector< crypto::public_key > keys
std::vector< uint8_t > script
std::vector< uint8_t > validators
a archive using the JSON standard
std::size_t operator()(const cryptonote::account_public_address &addr) const
for dealing with variants