34 #include <boost/variant.hpp> 35 #include <boost/functional/hash/hash.hpp> 97 return !(*
this == rhs);
105 std::vector<crypto::public_key>
keys;
137 std::stringstream ss;
147 ar.serialize_string(etn_address);
148 if (!ar.stream().good())
241 template<typename
T> static
inline unsigned int getpos(
T &ar) {
return 0; }
301 mutable std::atomic<bool> hash_valid;
302 mutable std::atomic<bool> blob_size_valid;
322 void invalidate_hashes();
323 bool is_hash_valid()
const {
return hash_valid.load(std::memory_order_acquire); }
324 void set_hash_valid(
bool v)
const { hash_valid.store(v,std::memory_order_release); }
328 void set_blob_size(
size_t sz) { blob_size = sz; set_blob_size_valid(
true); }
331 if (!typename Archive<W>::is_saving())
333 set_hash_valid(
false);
334 set_blob_size_valid(
false);
337 const unsigned int start_pos = getpos(ar);
339 FIELDS(*static_cast<transaction_prefix *>(
this))
343 prefix_size = getpos(ar) - start_pos;
344 unprunable_size = getpos(ar) - start_pos;
347 ar.tag(
"signatures");
350 bool signatures_not_expected = signatures.empty();
351 if (!signatures_not_expected && vin.size() != signatures.size())
354 if (!pruned)
for (
size_t i = 0; i < vin.size(); ++i)
356 size_t signature_size = get_signature_size(vin[i]);
357 if (signatures_not_expected)
359 if (0 == signature_size)
366 if (signature_size != signatures[i].size())
371 if (vin.size() - i > 1)
376 if (!
typename Archive<W>::is_saving())
380 template<
bool W, template <
bool> class Archive>
381 bool serialize_base(Archive<W> &ar)
383 FIELDS(*static_cast<transaction_prefix *>(
this))
385 if (!typename Archive<W>::is_saving())
387 return ar.stream().good();
391 static
size_t get_signature_size(const
txin_v& tx_in);
412 set_hash_valid(
false);
413 set_blob_size_valid(
false);
422 set_hash_valid(
false);
423 set_blob_size_valid(
false);
427 size_t transaction::get_signature_size(
const txin_v& tx_in)
429 struct txin_signature_size_visitor :
public boost::static_visitor<size_t>
431 size_t operator()(
const txin_gen& txin)
const{
return 0;}
432 size_t operator()(
const txin_to_script& txin)
const{
return 0;}
433 size_t operator()(
const txin_to_scripthash& txin)
const{
return 0;}
434 size_t operator()(
const txin_to_key& txin)
const {
return txin.key_offsets.size();}
435 size_t operator()(
const txin_to_key_public& txin)
const {
return 1;}
438 return boost::apply_visitor(txin_signature_size_visitor(), tx_in);
467 mutable std::atomic<bool> hash_valid;
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); }
487 if (!typename Archive<W>::is_saving())
488 set_hash_valid(
false);
block & operator=(const block &b)
void set_null_besides_version()
std::vector< crypto::hash > tx_hashes
uint64_t relative_out_index
void set_blob_size(size_t sz)
void set_hash(const crypto::hash &h)
std::vector< uint8_t > signatory
bool is_blob_size_valid() const
boost::variant< txin_gen, txin_to_script, txin_to_scripthash, txin_to_key, txin_to_key_public > txin_v
boost::variant< txout_to_script, txout_to_scripthash, txout_to_key, txout_to_key_public > txout_target_v
cryptonote::account_public_address address
transaction(const transaction &t)
std::vector< uint64_t > key_offsets
std::vector< uint8_t > validators
std::vector< crypto::signature > ring_signature
std::vector< uint8_t > extra
#define END_SERIALIZE()
self-explanatory
std::vector< tx_out > vout
Holds cryptonote related classes and helpers.
bool is_hash_valid() const
std::vector< txin_v > vin
crypto::public_key m_spend_public_key
std::vector< uint8_t > script
for dealing with variants
crypto::public_key m_view_public_key
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
void set_blob_size_valid(bool v) const
rct::rctSig rct_signatures
void set_hash_valid(bool v) const
#define FIELDS(f)
does not add a tag to the serialized value
void serialize(Archive &a, unsigned_tx_set &x, const boost::serialization::version_type ver)
unsigned __int64 uint64_t
#define BEGIN_SERIALIZE_OBJECT()
begins the environment of the DSL for described the serialization of an object
void load(Archive &a, std::unordered_map< h_key, hval > &x, const boost::serialization::version_type ver)
static keypair generate(hw::device &hwdev)
version
Supported socks variants.
bool is_hash_valid() const
BLOB_SERIALIZER(cryptonote::txout_to_key)
std::vector< std::vector< crypto::signature > > signatures
std::atomic< unsigned int > prefix_size
std::vector< uint8_t > sigset
std::vector< uint8_t > signature
transaction & operator=(const transaction &t)
#define CRYPTONOTE_MAX_TX_PER_BLOCK
#define VARINT_FIELD(f)
tags and serializes the varint f
VARIANT_TAG(binary_archive, cryptonote::txin_gen, 0xff)
std::vector< uint8_t > sigset
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(varialble)
crypto::key_image k_image
void set_hash_valid(bool v) const
uint64_t m_address_prefix
#define BEGIN_SERIALIZE()
Begins the environment of the DSL for describing how to serialize an of an archive type...
connection< TProtocol > & operator=(const connection< TProtocol > &obj)
std::vector< crypto::public_key > keys
txout_to_key(const crypto::public_key &_key)
#define CURRENT_TRANSACTION_VERSION
#define PREPARE_CUSTOM_VECTOR_SERIALIZATION(size, vec)
#define END_KV_SERIALIZE_MAP()
bool operator!=(const account_public_address &rhs) const
#define FIELD(f)
tags the field with the variable name and then serializes it
std::size_t operator()(const cryptonote::account_public_address &addr) const
#define BEGIN_KV_SERIALIZE_MAP()
std::atomic< unsigned int > unprunable_size
a archive using the JSON standard