forknote / cryptonote-generator

Generate Cryptonote coin with 1 command
104 stars 211 forks source link

Next hardfork - how to add in code #78

Closed servc4 closed 6 years ago

servc4 commented 6 years ago

Hi I wold like to prepare my source to hardfork with Zawy LWMA and I need to make V4 in my source. Below I posted corrections what I made and I hope it's ok because I couldn't find any info how to do that.. And please correct me if there is missing something or is some error.

**src/CryptoNoteConfig.h add**
const uint32_t UPGRADE_HEIGHT_V4                             = 350000;
const uint8_t  BLOCK_MAJOR_VERSION_4                         =  4;

**src/CryptoNoteCore/CachedBlock.cpp**

  cn_slow_hash(cryptoContext, rawHashingBlock.data(), rawHashingBlock.size(), blockLongHash.get());
} else if (block.majorVersion >= BLOCK_MAJOR_VERSION_2) {

**change on**

  cn_slow_hash(cryptoContext, rawHashingBlock.data(), rawHashingBlock.size(), blockLongHash.get());
   } else if ((block.majorVersion == BLOCK_MAJOR_VERSION_2) || (block.majorVersion == BLOCK_MAJOR_VERSION_3)) {

**src/CryptoNoteCore/Core.cpp add**

  upgradeManager->addMajorBlockVersion(BLOCK_MAJOR_VERSION_4, currency.upgradeHeight(BLOCK_MAJOR_VERSION_4));

**src/CryptoNoteCore/CryptoNoteSerialization.cpp**

**change**
 if (header.majorVersion > BLOCK_MAJOR_VERSION_3) {

**on this**

 if (header.majorVersion > BLOCK_MAJOR_VERSION_4) {

**src/CryptoNoteCore/Currency.cpp add**

 } else if (majorVersion == BLOCK_MAJOR_VERSION_4) {
   return m_upgradeHeightV4;

   **and**

 case BLOCK_MAJOR_VERSION_4:

    **and**

 m_upgradeHeightV4(currency.m_upgradeHeightV4),

    **and**

 upgradeHeightV4(parameters::UPGRADE_HEIGHT_V4);

 **src/CryptoNoteCore/Currency.h add**

  uint32_t m_upgradeHeightV4;

  **and**

 CurrencyBuilder& upgradeHeightV4(uint32_t val) { m_currency.m_upgradeHeightV4 = val; return *this; }

Regards