diff --git a/src/cryptonote_core/cryptonote_basic.h b/src/cryptonote_core/cryptonote_basic.h index e3e22df..fe1ceba 100644 --- a/src/cryptonote_core/cryptonote_basic.h +++ b/src/cryptonote_core/cryptonote_basic.h @@ -471,7 +471,7 @@ namespace cryptonote struct block_header { - //enum BLOB_TYPE blob_type; + enum BLOB_TYPE blob_type; uint8_t major_version; uint8_t minor_version; @@ -482,9 +482,9 @@ namespace cryptonote BEGIN_SERIALIZE() VARINT_FIELD(major_version) VARINT_FIELD(minor_version) - if (BLOB_TYPE_CRYPTONOTE != BLOB_TYPE_FORKNOTE2) VARINT_FIELD(timestamp) + if (blob_type != BLOB_TYPE_FORKNOTE2) VARINT_FIELD(timestamp) FIELD(prev_id) - if (BLOB_TYPE_CRYPTONOTE != BLOB_TYPE_FORKNOTE2) FIELD(nonce) + if (blob_type != BLOB_TYPE_FORKNOTE2) FIELD(nonce) END_SERIALIZE() }; @@ -497,7 +497,7 @@ namespace cryptonote BEGIN_SERIALIZE_OBJECT() FIELDS(*static_cast(this)) - if (BLOB_TYPE_CRYPTONOTE == BLOB_TYPE_FORKNOTE2) + if (blob_type == BLOB_TYPE_FORKNOTE2) { auto sbb = make_serializable_bytecoin_block(*this, false, false); FIELD_N("parent_block", sbb); diff --git a/src/cryptonote_core/cryptonote_format_utils.cpp b/src/cryptonote_core/cryptonote_format_utils.cpp index 6513e89..c45d787 100644 --- a/src/cryptonote_core/cryptonote_format_utils.cpp +++ b/src/cryptonote_core/cryptonote_format_utils.cpp @@ -509,7 +509,7 @@ namespace cryptonote if (!get_block_hashing_blob(b, blob)) return false; - if (BLOB_TYPE_CRYPTONOTE == BLOB_TYPE_FORKNOTE2) + if (b.blob_type == BLOB_TYPE_FORKNOTE2) { blobdata parent_blob; auto sbb = make_serializable_bytecoin_block(b, true, false); diff --git a/src/main.cc b/src/main.cc index 4836cd3..0598a6f 100644 --- a/src/main.cc +++ b/src/main.cc @@ -87,10 +87,10 @@ NAN_METHOD(convert_blob) { //convert block b = AUTO_VAL_INIT(b); - //b.blob_type = blob_type; + b.blob_type = blob_type; 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 || b.major_version == BLOCK_MAJOR_VERSION_3) { + if (blob_type == BLOB_TYPE_FORKNOTE2) { block parent_block; if (!construct_parent_block(b, parent_block)) return THROW_ERROR_EXCEPTION("Failed to construct parent block"); if (!get_block_hashing_blob(parent_block, output)) return THROW_ERROR_EXCEPTION("Failed to create mining block"); @@ -118,7 +118,7 @@ NAN_METHOD(get_block_id) { } block b = AUTO_VAL_INIT(b); - //b.blob_type = blob_type; + b.blob_type = blob_type; if (!parse_and_validate_block_from_blob(input, b)) return THROW_ERROR_EXCEPTION("Failed to parse block"); crypto::hash block_id; @@ -149,11 +149,11 @@ NAN_METHOD(construct_block_blob) { } block b = AUTO_VAL_INIT(b); - //b.blob_type = blob_type; + b.blob_type = blob_type; if (!parse_and_validate_block_from_blob(block_template_blob, b)) return THROW_ERROR_EXCEPTION("Failed to parse block"); b.nonce = nonce; - if (b.major_version == BLOCK_MAJOR_VERSION_2 || b.major_version == BLOCK_MAJOR_VERSION_3) { + if (blob_type == BLOB_TYPE_FORKNOTE2) { block parent_block; b.parent_block.nonce = nonce; if (!construct_parent_block(b, parent_block)) return THROW_ERROR_EXCEPTION("Failed to construct parent block");