2424#include " crypto/hash.h"
2525#include " misc_language.h"
2626#include " tx_extra.h"
27+ #include " ringct/rctTypes.h"
2728
2829
2930namespace cryptonote
@@ -189,6 +190,7 @@ namespace cryptonote
189190 {
190191 public:
191192 std::vector<std::vector<crypto::signature> > signatures; // count signatures always the same as inputs count
193+ rct::rctSig rct_signatures;
192194
193195 transaction ();
194196 virtual ~transaction ();
@@ -197,34 +199,57 @@ namespace cryptonote
197199 BEGIN_SERIALIZE_OBJECT ()
198200 FIELDS (*static_cast <transaction_prefix *>(this ))
199201
200- ar.tag(" signatures" );
201- ar.begin_array();
202- PREPARE_CUSTOM_VECTOR_SERIALIZATION (vin.size(), signatures);
203- bool signatures_not_expected = signatures.empty();
204- if (!signatures_not_expected && vin.size() != signatures.size())
205- return false ;
206-
207- for (size_t i = 0 ; i < vin.size(); ++i)
202+ if (version == 1 )
208203 {
209- size_t signature_size = get_signature_size (vin[i]);
210- if (signatures_not_expected)
204+ ar.tag (" signatures" );
205+ ar.begin_array ();
206+ PREPARE_CUSTOM_VECTOR_SERIALIZATION (vin.size (), signatures);
207+ bool signatures_not_expected = signatures.empty ();
208+ if (!signatures_not_expected && vin.size () != signatures.size ())
209+ return false ;
210+
211+ for (size_t i = 0 ; i < vin.size (); ++i)
211212 {
212- if (0 == signature_size)
213- continue ;
214- else
213+ size_t signature_size = get_signature_size (vin[i]);
214+ if (signatures_not_expected)
215+ {
216+ if (0 == signature_size)
217+ continue ;
218+ else
219+ return false ;
220+ }
221+
222+ PREPARE_CUSTOM_VECTOR_SERIALIZATION (signature_size, signatures[i]);
223+ if (signature_size != signatures[i].size ())
215224 return false ;
216- }
217-
218- PREPARE_CUSTOM_VECTOR_SERIALIZATION (signature_size, signatures[i]);
219- if (signature_size != signatures[i].size ())
220- return false ;
221225
222- FIELDS (signatures[i]);
226+ FIELDS (signatures[i]);
223227
224- if (vin.size () - i > 1 )
225- ar.delimit_array ();
228+ if (vin.size () - i > 1 )
229+ ar.delimit_array ();
230+ }
231+ ar.end_array ();
232+ }
233+ else
234+ {
235+ ar.tag (" rct_signatures" );
236+ if (!vin.empty ())
237+ {
238+ ar.begin_object ();
239+ bool r = rct_signatures.serialize_rctsig_base (ar, vin.size (), vout.size ());
240+ if (!r || !ar.stream ().good ()) return false ;
241+ ar.end_object ();
242+ if (rct_signatures.type != rct::RCTTypeNull)
243+ {
244+ ar.tag (" rctsig_prunable" );
245+ ar.begin_object ();
246+ r = rct_signatures.p .serialize_rctsig_prunable (ar, rct_signatures.type , vin.size (), vout.size (),
247+ vin[0 ].type () == typeid (txin_to_key) ? boost::get<txin_to_key>(vin[0 ]).key_offsets .size () - 1 : 0 );
248+ if (!r || !ar.stream ().good ()) return false ;
249+ ar.end_object ();
250+ }
251+ }
226252 }
227- ar.end_array();
228253 END_SERIALIZE ()
229254
230255 private:
@@ -383,7 +408,6 @@ namespace cryptonote
383408
384409 BEGIN_SERIALIZE_OBJECT ()
385410 VARINT_FIELD_N (" major_version" , b.major_version);
386- if (b.major_version > CURRENT_BYTECOIN_BLOCK_MAJOR_VERSION) return false ;
387411 VARINT_FIELD_N (" minor_version" , b.minor_version);
388412 VARINT_FIELD (timestamp);
389413 FIELD_N (" prev_id" , b.prev_id);
@@ -456,17 +480,10 @@ namespace cryptonote
456480
457481 BEGIN_SERIALIZE ()
458482 VARINT_FIELD (major_version)
459- if (major_version > BLOCK_MAJOR_VERSION_2) return false ;
460483 VARINT_FIELD (minor_version)
461- if (BLOCK_MAJOR_VERSION_1 == major_version)
462- {
463- VARINT_FIELD (timestamp)
464- }
484+ VARINT_FIELD (timestamp)
465485 FIELD (prev_id)
466- if (BLOCK_MAJOR_VERSION_1 == major_version)
467- {
468- FIELD (nonce)
469- }
486+ FIELD (nonce)
470487 END_SERIALIZE ()
471488 };
472489
@@ -479,11 +496,6 @@ namespace cryptonote
479496
480497 BEGIN_SERIALIZE_OBJECT ()
481498 FIELDS (*static_cast <block_header *>(this ))
482- if (BLOCK_MAJOR_VERSION_2 <= major_version)
483- {
484- auto sbb = make_serializable_bytecoin_block (*this , false , false );
485- FIELD_N (" parent_block" , sbb);
486- }
487499 FIELD (miner_tx)
488500 FIELD (tx_hashes)
489501 END_SERIALIZE ()
@@ -547,7 +559,23 @@ namespace cryptonote
547559 END_KV_SERIALIZE_MAP ()
548560 };
549561
550- struct keypair
562+ struct integrated_address {
563+ account_public_address adr;
564+ crypto::hash8 payment_id;
565+
566+ BEGIN_SERIALIZE_OBJECT ()
567+ FIELD (adr)
568+ FIELD (payment_id)
569+ END_SERIALIZE ()
570+
571+ BEGIN_KV_SERIALIZE_MAP ()
572+ KV_SERIALIZE (adr)
573+ KV_SERIALIZE (payment_id)
574+ END_KV_SERIALIZE_MAP ()
575+ };
576+
577+
578+ struct keypair
551579 {
552580 crypto::public_key pub;
553581 crypto::secret_key sec;
0 commit comments