Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cryptonote_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#define BLOCK_MAJOR_VERSION_1 1
#define BLOCK_MAJOR_VERSION_2 2
#define BLOCK_MAJOR_VERSION_3 3

#define COIN ((uint64_t)100000000) // pow(10, 8)
#define DEFAULT_FEE ((uint64_t)1000000) // pow(10, 6)
Expand Down
4 changes: 2 additions & 2 deletions src/cryptonote_core/cryptonote_basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ namespace cryptonote

BEGIN_SERIALIZE()
VARINT_FIELD(major_version)
if(major_version > BLOCK_MAJOR_VERSION_2) return false;
if(major_version > BLOCK_MAJOR_VERSION_3) return false;
VARINT_FIELD(minor_version)
if (BLOCK_MAJOR_VERSION_1 == major_version)
{
Expand All @@ -479,7 +479,7 @@ namespace cryptonote

BEGIN_SERIALIZE_OBJECT()
FIELDS(*static_cast<block_header *>(this))
if (BLOCK_MAJOR_VERSION_2 <= major_version)
if (BLOCK_MAJOR_VERSION_3 <= major_version)
{
auto sbb = make_serializable_bytecoin_block(*this, false, false);
FIELD_N("parent_block", sbb);
Expand Down
5 changes: 3 additions & 2 deletions src/cryptonote_core/cryptonote_format_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ namespace cryptonote
if (!get_block_hashing_blob(b, blob))
return false;

if (BLOCK_MAJOR_VERSION_2 <= b.major_version)
if (BLOCK_MAJOR_VERSION_3 <= b.major_version)
{
blobdata parent_blob;
auto sbb = make_serializable_bytecoin_block(b, true, false);
Expand Down Expand Up @@ -860,7 +860,7 @@ 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)
if (BLOCK_MAJOR_VERSION_2 != bl.major_version || BLOCK_MAJOR_VERSION_3 != bl.major_version )
return false;

if (!get_bytecoin_block_longhash(bl, proof_of_work))
Expand Down Expand Up @@ -900,6 +900,7 @@ namespace cryptonote
{
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_v2(bl, current_diffic, proof_of_work);
case BLOCK_MAJOR_VERSION_3: return check_proof_of_work_v2(bl, current_diffic, proof_of_work);
}

CHECK_AND_ASSERT_MES(false, false, "unknown block major version: " << bl.major_version << "." << bl.minor_version);
Expand Down
2 changes: 1 addition & 1 deletion src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Handle<Value> construct_block_blob(const Arguments& args) {
return except("Failed to parse block");

b.nonce = nonce;
if (b.major_version == BLOCK_MAJOR_VERSION_2) {
if (b.major_version == BLOCK_MAJOR_VERSION_2 || b.major_version == BLOCK_MAJOR_VERSION_3) {
block parent_block;
b.parent_block.nonce = nonce;
if (!construct_parent_block(b, parent_block))
Expand Down