Skip to content

Commit 55a1dde

Browse files
authored
Merge pull request fancoder#2 from Gingeropolous/xmr-Nan-2.0
deletel line 411 minor major return false
2 parents 31c531b + 48551c3 commit 55a1dde

File tree

4 files changed

+17
-42
lines changed

4 files changed

+17
-42
lines changed

src/cryptonote_core/cryptonote_basic.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,6 @@ namespace cryptonote
408408

409409
BEGIN_SERIALIZE_OBJECT()
410410
VARINT_FIELD_N("major_version", b.major_version);
411-
if(b.major_version > CURRENT_BYTECOIN_BLOCK_MAJOR_VERSION) return false;
412411
VARINT_FIELD_N("minor_version", b.minor_version);
413412
VARINT_FIELD(timestamp);
414413
FIELD_N("prev_id", b.prev_id);

src/cryptonote_core/cryptonote_format_utils.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -650,16 +650,6 @@ namespace cryptonote
650650
if (!get_block_hashing_blob(b, blob))
651651
return false;
652652

653-
// if (BLOCK_MAJOR_VERSION_2 <= b.major_version)
654-
// {
655-
// blobdata parent_blob;
656-
// auto sbb = make_serializable_bytecoin_block(b, true, false);
657-
// if (!t_serializable_object_to_blob(sbb, parent_blob))
658-
// return false;
659-
660-
// blob.append(parent_blob);
661-
// }
662-
663653
return get_object_hash(blob, res);
664654
}
665655
//---------------------------------------------------------------
@@ -698,8 +688,6 @@ namespace cryptonote
698688
string_tools::parse_hexstr_to_binbuff(genesis_coinbase_tx_hex, tx_bl);
699689
bool r = parse_and_validate_tx_from_blob(tx_bl, bl.miner_tx);
700690
CHECK_AND_ASSERT_MES(r, false, "failed to parse coinbase tx from hard coded blob");
701-
bl.major_version = CURRENT_BLOCK_MAJOR_VERSION;
702-
bl.minor_version = CURRENT_BLOCK_MINOR_VERSION;
703691
bl.timestamp = 0;
704692
bl.nonce = 10000;
705693
miner::find_nonce_for_given_block(bl, 1, 0);
@@ -851,17 +839,13 @@ namespace cryptonote
851839
//---------------------------------------------------------------
852840
bool check_proof_of_work_v1(const block& bl, difficulty_type current_diffic, crypto::hash& proof_of_work)
853841
{
854-
// if (BLOCK_MAJOR_VERSION_1 != bl.major_version)
855-
// return false;
856842

857843
proof_of_work = get_block_longhash(bl, 0);
858844
return check_hash(proof_of_work, current_diffic);
859845
}
860846
//---------------------------------------------------------------
861847
bool check_proof_of_work_v2(const block& bl, difficulty_type current_diffic, crypto::hash& proof_of_work)
862848
{
863-
if (BLOCK_MAJOR_VERSION_2 != bl.major_version)
864-
return false;
865849

866850
if (!get_bytecoin_block_longhash(bl, proof_of_work))
867851
return false;
@@ -896,13 +880,6 @@ namespace cryptonote
896880
//---------------------------------------------------------------
897881
bool check_proof_of_work(const block& bl, difficulty_type current_diffic, crypto::hash& proof_of_work)
898882
{
899-
switch (bl.major_version)
900-
{
901-
case BLOCK_MAJOR_VERSION_1: return check_proof_of_work_v1(bl, current_diffic, proof_of_work);
902-
case BLOCK_MAJOR_VERSION_2: return check_proof_of_work_v1(bl, current_diffic, proof_of_work);
903-
}
904-
905-
CHECK_AND_ASSERT_MES(false, false, "unknown block major version: " << bl.major_version << "." << bl.minor_version);
906883
}
907884
//---------------------------------------------------------------
908885
}

src/main.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,7 @@ NAN_METHOD(convert_blob_fa) {
125125
if (!parse_and_validate_block_from_blob(input, b))
126126
return THROW_ERROR_EXCEPTION("Failed to parse block");
127127

128-
if (b.major_version < BLOCK_MAJOR_VERSION_2) {
129-
if (!get_block_hashing_blob(b, output))
130-
return THROW_ERROR_EXCEPTION("Failed to create mining block");
131-
} else {
128+
else {
132129
block parent_block;
133130
if (!construct_parent_block(b, parent_block))
134131
return THROW_ERROR_EXCEPTION("Failed to construct parent block");

src/ringct/rctTypes.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,10 @@ namespace rct {
125125
typedef unsigned int bits[ATOMS];
126126
typedef key key64[64];
127127

128-
//just contains the necessary keys to represent asnlSigs
129-
//c.f. http://eprint.iacr.org/2015/1098
130-
struct asnlSig {
131-
key64 L1;
132-
key64 s2;
133-
key s;
128+
struct boroSig {
129+
key64 s0;
130+
key64 s1;
131+
key ee;
134132
};
135133

136134
//Container for precomp
@@ -151,14 +149,14 @@ namespace rct {
151149
// FIELD(II) - not serialized, it can be reconstructed
152150
END_SERIALIZE()
153151
};
154-
//contains the data for an asnl sig
152+
//contains the data for an Borromean sig
155153
// also contains the "Ci" values such that
156154
// \sum Ci = C
157155
// and the signature proves that each Ci is either
158156
// a Pedersen commitment to 0 or to 2^i
159157
//thus proving that C is in the range of [0, 2^64]
160158
struct rangeSig {
161-
asnlSig asig;
159+
boroSig asig;
162160
key64 Ci;
163161

164162
BEGIN_SERIALIZE_OBJECT()
@@ -281,6 +279,7 @@ namespace rct {
281279
// we save the MGs contents directly, because we want it to save its
282280
// arrays and matrices without the size prefixes, and the load can't
283281
// know what size to expect if it's not in the data
282+
ar.begin_object();
284283
ar.tag("ss");
285284
ar.begin_array();
286285
PREPARE_CUSTOM_VECTOR_SERIALIZATION(mixin + 1, MGs[i].ss);
@@ -296,7 +295,7 @@ namespace rct {
296295
for (size_t k = 0; k < mg_ss2_elements; ++k)
297296
{
298297
FIELDS(MGs[i].ss[j][k])
299-
if (mg_ss2_elements - j > 1)
298+
if (mg_ss2_elements - k > 1)
300299
ar.delimit_array();
301300
}
302301
ar.end_array();
@@ -306,10 +305,13 @@ namespace rct {
306305
}
307306
ar.end_array();
308307

308+
ar.tag("cc");
309309
FIELDS(MGs[i].cc)
310310
// MGs[i].II not saved, it can be reconstructed
311311
if (mg_elements - i > 1)
312312
ar.delimit_array();
313+
314+
ar.end_object();
313315
}
314316
ar.end_array();
315317
return true;
@@ -415,7 +417,7 @@ namespace rct {
415417
// then the value in the first 8 bytes is returned
416418
xmr_amount h2d(const key &test);
417419
//32 byte key to int[64]
418-
void h2b(bits amountb2, key & test);
420+
void h2b(bits amountb2, const key & test);
419421
//int[64] to 32 byte key
420422
void b2h(key & amountdh, bits amountb2);
421423
//int[64] to uint long long
@@ -448,7 +450,7 @@ inline std::ostream &operator <<(std::ostream &o, const rct::key &v) { return pr
448450
BLOB_SERIALIZER(rct::key);
449451
BLOB_SERIALIZER(rct::key64);
450452
BLOB_SERIALIZER(rct::ctkey);
451-
BLOB_SERIALIZER(rct::asnlSig);
453+
BLOB_SERIALIZER(rct::boroSig);
452454

453455
VARIANT_TAG(debug_archive, rct::key, "rct::key");
454456
VARIANT_TAG(debug_archive, rct::key64, "rct::key64");
@@ -460,7 +462,7 @@ VARIANT_TAG(debug_archive, rct::ctkeyM, "rct::ctkeyM");
460462
VARIANT_TAG(debug_archive, rct::ecdhTuple, "rct::ecdhTuple");
461463
VARIANT_TAG(debug_archive, rct::mgSig, "rct::mgSig");
462464
VARIANT_TAG(debug_archive, rct::rangeSig, "rct::rangeSig");
463-
VARIANT_TAG(debug_archive, rct::asnlSig, "rct::asnlSig");
465+
VARIANT_TAG(debug_archive, rct::boroSig, "rct::boroSig");
464466
VARIANT_TAG(debug_archive, rct::rctSig, "rct::rctSig");
465467

466468
VARIANT_TAG(binary_archive, rct::key, 0x90);
@@ -473,7 +475,7 @@ VARIANT_TAG(binary_archive, rct::ctkeyM, 0x96);
473475
VARIANT_TAG(binary_archive, rct::ecdhTuple, 0x97);
474476
VARIANT_TAG(binary_archive, rct::mgSig, 0x98);
475477
VARIANT_TAG(binary_archive, rct::rangeSig, 0x99);
476-
VARIANT_TAG(binary_archive, rct::asnlSig, 0x9a);
478+
VARIANT_TAG(binary_archive, rct::boroSig, 0x9a);
477479
VARIANT_TAG(binary_archive, rct::rctSig, 0x9b);
478480

479481
VARIANT_TAG(json_archive, rct::key, "rct_key");
@@ -486,7 +488,7 @@ VARIANT_TAG(json_archive, rct::ctkeyM, "rct_ctkeyM");
486488
VARIANT_TAG(json_archive, rct::ecdhTuple, "rct_ecdhTuple");
487489
VARIANT_TAG(json_archive, rct::mgSig, "rct_mgSig");
488490
VARIANT_TAG(json_archive, rct::rangeSig, "rct_rangeSig");
489-
VARIANT_TAG(json_archive, rct::asnlSig, "rct_asnlSig");
491+
VARIANT_TAG(json_archive, rct::boroSig, "rct_boroSig");
490492
VARIANT_TAG(json_archive, rct::rctSig, "rct_rctSig");
491493

492494
#endif /* RCTTYPES_H */

0 commit comments

Comments
 (0)