Skip to content

Included block version 4 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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 @@ -8,6 +8,7 @@
#define BLOCK_MAJOR_VERSION_1 1
#define BLOCK_MAJOR_VERSION_2 2
#define BLOCK_MAJOR_VERSION_3 3
#define BLOCK_MAJOR_VERSION_4 4

#define COIN ((uint64_t)100000000) // pow(10, 8)
#define DEFAULT_FEE ((uint64_t)1000000) // pow(10, 6)
Expand Down
2 changes: 1 addition & 1 deletion 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_3) return false;
if(major_version > BLOCK_MAJOR_VERSION_4) return false;
VARINT_FIELD(minor_version)
if (BLOCK_MAJOR_VERSION_1 == major_version)
{
Expand Down
3 changes: 2 additions & 1 deletion src/cryptonote_core/cryptonote_format_utils.cpp
Original file line number Diff line number Diff line change
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 || BLOCK_MAJOR_VERSION_3 != bl.major_version)
if (BLOCK_MAJOR_VERSION_2 != bl.major_version && BLOCK_MAJOR_VERSION_3 != bl.major_version && BLOCK_MAJOR_VERSION_4 != bl.major_version)
return false;

if (!get_bytecoin_block_longhash(bl, proof_of_work))
Expand Down Expand Up @@ -901,6 +901,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);
case BLOCK_MAJOR_VERSION_4: 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 @@ -172,7 +172,7 @@ Handle<Value> construct_block_blob(const Arguments& args) {
if (!mergeBlocks(parent_block, b, std::vector<crypto::hash>()))
return except("Failed to postprocess mining block");
}
if (b.major_version == BLOCK_MAJOR_VERSION_3) {
if (b.major_version >= BLOCK_MAJOR_VERSION_3) {
block parent_block;
b.parent_block.nonce = nonce;
if (!construct_parent_block(b, parent_block))
Expand Down