From a9813d6c4e796b6c510aef737e1a8a10f9e28edf Mon Sep 17 00:00:00 2001 From: Vu Quang Date: Thu, 31 May 2018 17:30:32 +0700 Subject: [PATCH] Aomori Point Release 2 A hardfork to be back to classic cryptonight hashing algo --- src/cryptonote_config.h | 1 + src/cryptonote_core/blockchain.cpp | 7 +++++-- src/cryptonote_core/checkpoints.cpp | 1 + src/cryptonote_core/cryptonote_format_utils.cpp | 8 ++++---- src/version.h.in | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index c250078..6b1ebe4 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -45,6 +45,7 @@ #define CURRENT_TRANSACTION_VERSION 2 #define MIN_TRANSACTION_VERSION 2 #define CRYPTONOTE_V2_POW_BLOCK_VERSION 3 +#define CRYPTONOTE_CLASSIC_POW_BLOCK_VERSION 4 #define CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT 60*60*2 #define CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE 10 #define BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW 60 diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index f1d6df5..d6e97f4 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -75,6 +75,7 @@ DISABLE_VS_WARNINGS(4267) // used to overestimate the block reward when estimating a per kB to use #define BLOCK_REWARD_OVERESTIMATE ((uint64_t)(16000000000)) #define MAINNET_HARDFORK_V3_HEIGHT ((uint64_t)(116520)) +#define MAINNET_HARDFORK_V4_HEIGHT ((uint64_t)(137500)) static const struct { uint8_t version; @@ -84,7 +85,8 @@ static const struct { } mainnet_hard_forks[] = { { 1, 1, 0, 1482806500 }, { 2, 21300, 0, 1497657600 }, - { 3, MAINNET_HARDFORK_V3_HEIGHT, 0, 1522800000 } + { 3, MAINNET_HARDFORK_V3_HEIGHT, 0, 1522800000 }, + { 4, MAINNET_HARDFORK_V4_HEIGHT, 0, 1528045200 } }; static const uint64_t mainnet_hard_fork_version_1_till = (uint64_t)-1; @@ -96,7 +98,8 @@ static const struct { } testnet_hard_forks[] = { { 1, 1, 0, 1482806500 }, { 2, 5150, 0, 1497181713 }, - { 3, 103580, 0, 1522540800 } // April 01, 2018 + { 3, 103580, 0, 1522540800 }, + { 4, 122452, 0, 1527699600 } }; static const uint64_t testnet_hard_fork_version_1_till = (uint64_t)-1; diff --git a/src/cryptonote_core/checkpoints.cpp b/src/cryptonote_core/checkpoints.cpp index 0b33739..a122722 100644 --- a/src/cryptonote_core/checkpoints.cpp +++ b/src/cryptonote_core/checkpoints.cpp @@ -172,6 +172,7 @@ namespace cryptonote ADD_CHECKPOINT(75000, "b26f4e1225569da282b77659020bace52e5e89abbdee33e9e52266b1e71803a5"); ADD_CHECKPOINT(100000, "ffe474fe8353f90700c8138ddea3547d5c1e4a6facb1df85897e7a6e4daab540"); ADD_CHECKPOINT(116520, "da1cb8f30305cd5fad7d6c33b3ed88fede053e0926102d8e544b65e93e33a08b"); // v3 fork + ADD_CHECKPOINT(136240, "addf156324aa69a8c2ca2236ba3a205ab63d0d3fc23f75a57fb7c94123c578ab"); return true; } diff --git a/src/cryptonote_core/cryptonote_format_utils.cpp b/src/cryptonote_core/cryptonote_format_utils.cpp index f803283..914aada 100644 --- a/src/cryptonote_core/cryptonote_format_utils.cpp +++ b/src/cryptonote_core/cryptonote_format_utils.cpp @@ -1242,14 +1242,14 @@ namespace cryptonote { block b_local = b; //workaround to avoid const errors with do_serialize blobdata bd = get_block_hashing_blob(b); - if(b_local.major_version < CRYPTONOTE_V2_POW_BLOCK_VERSION) + if(b_local.major_version == CRYPTONOTE_V2_POW_BLOCK_VERSION) { - cn_pow_hash_v1 ctx_v1 = cn_pow_hash_v1::make_borrowed(ctx); - ctx_v1.hash(bd.data(), bd.size(), res.data); + ctx.hash(bd.data(), bd.size(), res.data); } else { - ctx.hash(bd.data(), bd.size(), res.data); + cn_pow_hash_v1 ctx_v1 = cn_pow_hash_v1::make_borrowed(ctx); + ctx_v1.hash(bd.data(), bd.size(), res.data); } return true; } diff --git a/src/version.h.in b/src/version.h.in index 281f214..1eccc67 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -1,4 +1,4 @@ #define SUMOKOIN_VERSION_TAG "@VERSIONTAG@" -#define SUMOKOIN_VERSION "0.3.1.0" +#define SUMOKOIN_VERSION "0.3.2.0" #define SUMOKOIN_RELEASE_NAME "Aomori" #define SUMOKOIN_VERSION_FULL SUMOKOIN_VERSION "-" SUMOKOIN_VERSION_TAG