diff --git a/src/cryptonote_core/cryptonote_basic.h b/src/cryptonote_core/cryptonote_basic.h index 20d333dc..2677fe3d 100644 --- a/src/cryptonote_core/cryptonote_basic.h +++ b/src/cryptonote_core/cryptonote_basic.h @@ -408,7 +408,6 @@ namespace cryptonote BEGIN_SERIALIZE_OBJECT() VARINT_FIELD_N("major_version", b.major_version); - if(b.major_version > CURRENT_BYTECOIN_BLOCK_MAJOR_VERSION) return false; VARINT_FIELD_N("minor_version", b.minor_version); VARINT_FIELD(timestamp); FIELD_N("prev_id", b.prev_id); diff --git a/src/cryptonote_core/cryptonote_format_utils.cpp b/src/cryptonote_core/cryptonote_format_utils.cpp index 739b3b64..b30c20cc 100644 --- a/src/cryptonote_core/cryptonote_format_utils.cpp +++ b/src/cryptonote_core/cryptonote_format_utils.cpp @@ -650,16 +650,6 @@ namespace cryptonote if (!get_block_hashing_blob(b, blob)) return false; -// if (BLOCK_MAJOR_VERSION_2 <= b.major_version) -// { -// blobdata parent_blob; -// auto sbb = make_serializable_bytecoin_block(b, true, false); -// if (!t_serializable_object_to_blob(sbb, parent_blob)) -// return false; - -// blob.append(parent_blob); -// } - return get_object_hash(blob, res); } //--------------------------------------------------------------- @@ -698,8 +688,6 @@ namespace cryptonote string_tools::parse_hexstr_to_binbuff(genesis_coinbase_tx_hex, tx_bl); bool r = parse_and_validate_tx_from_blob(tx_bl, bl.miner_tx); CHECK_AND_ASSERT_MES(r, false, "failed to parse coinbase tx from hard coded blob"); - bl.major_version = CURRENT_BLOCK_MAJOR_VERSION; - bl.minor_version = CURRENT_BLOCK_MINOR_VERSION; bl.timestamp = 0; bl.nonce = 10000; miner::find_nonce_for_given_block(bl, 1, 0); @@ -851,8 +839,6 @@ namespace cryptonote //--------------------------------------------------------------- bool check_proof_of_work_v1(const block& bl, difficulty_type current_diffic, crypto::hash& proof_of_work) { -// if (BLOCK_MAJOR_VERSION_1 != bl.major_version) -// return false; proof_of_work = get_block_longhash(bl, 0); return check_hash(proof_of_work, current_diffic); @@ -860,8 +846,6 @@ namespace cryptonote //--------------------------------------------------------------- bool check_proof_of_work_v2(const block& bl, difficulty_type current_diffic, crypto::hash& proof_of_work) { - if (BLOCK_MAJOR_VERSION_2 != bl.major_version) - return false; if (!get_bytecoin_block_longhash(bl, proof_of_work)) return false; @@ -896,13 +880,6 @@ namespace cryptonote //--------------------------------------------------------------- bool check_proof_of_work(const block& bl, difficulty_type current_diffic, crypto::hash& proof_of_work) { - switch (bl.major_version) - { - case BLOCK_MAJOR_VERSION_1: return check_proof_of_work_v1(bl, current_diffic, proof_of_work); - case BLOCK_MAJOR_VERSION_2: return check_proof_of_work_v1(bl, current_diffic, proof_of_work); - } - - CHECK_AND_ASSERT_MES(false, false, "unknown block major version: " << bl.major_version << "." << bl.minor_version); } //--------------------------------------------------------------- } diff --git a/src/main.cc b/src/main.cc index cf575a15..a8a3d028 100644 --- a/src/main.cc +++ b/src/main.cc @@ -125,10 +125,7 @@ NAN_METHOD(convert_blob_fa) { if (!parse_and_validate_block_from_blob(input, b)) return THROW_ERROR_EXCEPTION("Failed to parse block"); - if (b.major_version < BLOCK_MAJOR_VERSION_2) { - if (!get_block_hashing_blob(b, output)) - return THROW_ERROR_EXCEPTION("Failed to create mining block"); - } else { + else { block parent_block; if (!construct_parent_block(b, parent_block)) return THROW_ERROR_EXCEPTION("Failed to construct parent block"); diff --git a/src/ringct/rctTypes.h b/src/ringct/rctTypes.h index bfafebb8..71cc61dd 100644 --- a/src/ringct/rctTypes.h +++ b/src/ringct/rctTypes.h @@ -125,12 +125,10 @@ namespace rct { typedef unsigned int bits[ATOMS]; typedef key key64[64]; - //just contains the necessary keys to represent asnlSigs - //c.f. http://eprint.iacr.org/2015/1098 - struct asnlSig { - key64 L1; - key64 s2; - key s; + struct boroSig { + key64 s0; + key64 s1; + key ee; }; //Container for precomp @@ -151,14 +149,14 @@ namespace rct { // FIELD(II) - not serialized, it can be reconstructed END_SERIALIZE() }; - //contains the data for an asnl sig + //contains the data for an Borromean sig // also contains the "Ci" values such that // \sum Ci = C // and the signature proves that each Ci is either // a Pedersen commitment to 0 or to 2^i //thus proving that C is in the range of [0, 2^64] struct rangeSig { - asnlSig asig; + boroSig asig; key64 Ci; BEGIN_SERIALIZE_OBJECT() @@ -281,6 +279,7 @@ namespace rct { // we save the MGs contents directly, because we want it to save its // arrays and matrices without the size prefixes, and the load can't // know what size to expect if it's not in the data + ar.begin_object(); ar.tag("ss"); ar.begin_array(); PREPARE_CUSTOM_VECTOR_SERIALIZATION(mixin + 1, MGs[i].ss); @@ -296,7 +295,7 @@ namespace rct { for (size_t k = 0; k < mg_ss2_elements; ++k) { FIELDS(MGs[i].ss[j][k]) - if (mg_ss2_elements - j > 1) + if (mg_ss2_elements - k > 1) ar.delimit_array(); } ar.end_array(); @@ -306,10 +305,13 @@ namespace rct { } ar.end_array(); + ar.tag("cc"); FIELDS(MGs[i].cc) // MGs[i].II not saved, it can be reconstructed if (mg_elements - i > 1) ar.delimit_array(); + + ar.end_object(); } ar.end_array(); return true; @@ -415,7 +417,7 @@ namespace rct { // then the value in the first 8 bytes is returned xmr_amount h2d(const key &test); //32 byte key to int[64] - void h2b(bits amountb2, key & test); + void h2b(bits amountb2, const key & test); //int[64] to 32 byte key void b2h(key & amountdh, bits amountb2); //int[64] to uint long long @@ -448,7 +450,7 @@ inline std::ostream &operator <<(std::ostream &o, const rct::key &v) { return pr BLOB_SERIALIZER(rct::key); BLOB_SERIALIZER(rct::key64); BLOB_SERIALIZER(rct::ctkey); -BLOB_SERIALIZER(rct::asnlSig); +BLOB_SERIALIZER(rct::boroSig); VARIANT_TAG(debug_archive, rct::key, "rct::key"); VARIANT_TAG(debug_archive, rct::key64, "rct::key64"); @@ -460,7 +462,7 @@ VARIANT_TAG(debug_archive, rct::ctkeyM, "rct::ctkeyM"); VARIANT_TAG(debug_archive, rct::ecdhTuple, "rct::ecdhTuple"); VARIANT_TAG(debug_archive, rct::mgSig, "rct::mgSig"); VARIANT_TAG(debug_archive, rct::rangeSig, "rct::rangeSig"); -VARIANT_TAG(debug_archive, rct::asnlSig, "rct::asnlSig"); +VARIANT_TAG(debug_archive, rct::boroSig, "rct::boroSig"); VARIANT_TAG(debug_archive, rct::rctSig, "rct::rctSig"); VARIANT_TAG(binary_archive, rct::key, 0x90); @@ -473,7 +475,7 @@ VARIANT_TAG(binary_archive, rct::ctkeyM, 0x96); VARIANT_TAG(binary_archive, rct::ecdhTuple, 0x97); VARIANT_TAG(binary_archive, rct::mgSig, 0x98); VARIANT_TAG(binary_archive, rct::rangeSig, 0x99); -VARIANT_TAG(binary_archive, rct::asnlSig, 0x9a); +VARIANT_TAG(binary_archive, rct::boroSig, 0x9a); VARIANT_TAG(binary_archive, rct::rctSig, 0x9b); VARIANT_TAG(json_archive, rct::key, "rct_key"); @@ -486,7 +488,7 @@ VARIANT_TAG(json_archive, rct::ctkeyM, "rct_ctkeyM"); VARIANT_TAG(json_archive, rct::ecdhTuple, "rct_ecdhTuple"); VARIANT_TAG(json_archive, rct::mgSig, "rct_mgSig"); VARIANT_TAG(json_archive, rct::rangeSig, "rct_rangeSig"); -VARIANT_TAG(json_archive, rct::asnlSig, "rct_asnlSig"); +VARIANT_TAG(json_archive, rct::boroSig, "rct_boroSig"); VARIANT_TAG(json_archive, rct::rctSig, "rct_rctSig"); #endif /* RCTTYPES_H */