<NME> version.h
<BEF> // Copyright (c) 2012-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_VERSION_H
#define BITCOIN_VERSION_H

/**
 * network protocol versioning
 */

static const int PROTOCOL_VERSION = 90031;

//! legacy znode protocol version
static const int LEGACY_ZNODES_PROTOCOL_VERSION = 90026;

//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 90013;

//! In this version, 'getheaders' was introduced.
static const int GETHEADERS_VERSION = 90020;

//! disconnect from peers older than this proto version
static const int MIN_PEER_PROTO_VERSION = 90030;
// network protocol versioning
//

static const int PROTOCOL_VERSION = 90019;

// intial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 90013;

//! BIP 0031, pong message, is enabled for all versions AFTER this one
static const int BIP0031_VERSION = 90013;

//! "mempool" command, enhanced "getdata" behavior starts with this version
static const int MEMPOOL_GD_VERSION = 90013;

//! "filter*" commands are disabled without NODE_BLOOM after and including this version
static const int NO_BLOOM_VERSION = 90013;

//! "sendheaders" command and announcing blocks with headers starts with this version
static const int SENDHEADERS_VERSION = 90013;

//! "feefilter" tells peers to filter invs to you by fee starts with this version
static const int FEEFILTER_VERSION = 90013;

//! shord-id-based block download starts with this version
static const int SHORT_IDS_BLOCKS_VERSION = 90013;

//! not banning for invalid compact blocks starts with this version
static const int INVALID_CB_NO_BAN_VERSION = 90013;

//! minimum version of official client to connect to
static const int MIN_FIRO_CLIENT_VERSION = 141000; // 0.14.10.0

//! introduction of DIP3/deterministic masternodes
static const int DMN_PROTO_VERSION = 90030;

//! introduction of LLMQs
static const int LLMQS_PROTO_VERSION = 90030;

//! introducing blocks with stripped MTP data
static const int MTPDATA_STRIPPED_VERSION = 90031;

#endif // BITCOIN_VERSION_H

<MSG> Merge pull request #57 from zcoinofficial/Lyra2Z

Final Lyra2Z
<DFF> @@ -25,7 +25,7 @@ extern const std::string CLIENT_DATE;
 // network protocol versioning
 //
 
-static const int PROTOCOL_VERSION = 90019;
+static const int PROTOCOL_VERSION = 90020;
 
 // intial proto version, to be increased after version/verack negotiation
 static const int INIT_PROTO_VERSION = 90013;

{'commit': 'diff --git a/src/Lyra2Z/Lyra2Z.c b/src/Lyra2Z/Lyra2Z.c\nindex f5073e638..8d8c1aa89 100644\n--- a/src/Lyra2Z/Lyra2Z.c\n+++ b/src/Lyra2Z/Lyra2Z.c\n@@ -45,7 +45,7 @@ void lyra2z_hash(const char* input, char* output)\n     sph_blake256 (&ctx_blake, input, 80);\n     sph_blake256_close (&ctx_blake, hashA);\t\n \t\n-\tLYRA2(hashB, 32, hashA, 32, hashA, 32, 2, 16, 16);\n+\tLYRA2(hashB, 32, hashA, 32, hashA, 32, 8, 8, 8);\n \t\n \tmemcpy(output, hashB, 32);\n }\ndiff --git a/src/checkpoints.cpp b/src/checkpoints.cpp\nindex 23c49b7eb..33557eb34 100755\n--- a/src/checkpoints.cpp\n+++ b/src/checkpoints.cpp\n@@ -52,13 +52,13 @@ namespace Checkpoints\n \n     static MapCheckpoints mapCheckpointsTestnet = \n         boost::assign::map_list_of\n-        (     0, uint256("0xe900c15110857ca650625825761b00381699ef41451915468b1488644295671a"))\n+        (     0, uint256("0x"))\n         ;\n     static const CCheckpointData dataTestnet = {\n         &mapCheckpointsTestnet,\n-        1398863062,\n-        1,\n-        960.0\n+        1414776313,\n+        0,\n+        100.0\n     };\n \n     const CCheckpointData &Checkpoints() {\ndiff --git a/src/clientversion.h b/src/clientversion.h\nindex 7b4013e1a..d191e29c2 100755\n--- a/src/clientversion.h\n+++ b/src/clientversion.h\n@@ -9,7 +9,7 @@\n #define CLIENT_VERSION_MAJOR       0\n #define CLIENT_VERSION_MINOR       8\n #define CLIENT_VERSION_REVISION    7\n-#define CLIENT_VERSION_BUILD       3\n+#define CLIENT_VERSION_BUILD       4\n \n // Set to true for release, false for prerelease or test build\n #define CLIENT_VERSION_IS_RELEASE  true\ndiff --git a/src/init.cpp b/src/init.cpp\nindex 0f187107c..a29316757 100755\n--- a/src/init.cpp\n+++ b/src/init.cpp\n@@ -1044,7 +1044,7 @@ bool AppInit2(boost::thread_group& threadGroup)\n             // RECURSIVE, SET NEW ID\n             BOOST_FOREACH(const CZerocoinEntry& pubCoinItem, listPubCoin) {\n \n-                if(pubCoinItem.nHeight < lastCalculatedZCBlock){\n+                if(!fReindex && pubCoinItem.nHeight < lastCalculatedZCBlock){\n                     continue;\n                 }else{\n                     CZerocoinEntry pubCoinTx;\n@@ -1065,11 +1065,12 @@ bool AppInit2(boost::thread_group& threadGroup)\n             {\n                 while (pindexRecur)\n                 {\n-                    //printf("PROCESS BLOCK = %d\\n", pindexRecur->nHeight);\n-                    if(pindexRecur->nHeight < lastCalculatedZCBlock){\n+\n+                    if(!fReindex && (pindexRecur->nHeight < lastCalculatedZCBlock)){\n                         pindexRecur = pindexRecur->pnext;\n                         continue;\n                     }else{\n+                        printf("PROCESS BLOCK = %d\\n", pindexRecur->nHeight);\n                         CBlock blockRecur;\n                         blockRecur.ReadFromDisk(pindexRecur);\n \ndiff --git a/src/main.cpp b/src/main.cpp\nindex 31275c481..3b679127d 100755\n--- a/src/main.cpp\n+++ b/src/main.cpp\n@@ -757,7 +757,7 @@ bool CTransaction::CheckTransaction(CValidationState &state, uint256 hashTx, boo\n \n                     // CHECKING PROCESS\n                     BOOST_FOREACH(const CZerocoinEntry& pubCoinItem, listPubCoin) {\n-                        if (pubCoinItem.value == pubCoin)\n+                        if (pubCoinItem.value == pubCoin && pubCoinItem.denomination == denomination)\n                         {\n                             isAlreadyStored = true;\n                         }\n@@ -831,6 +831,7 @@ bool CTransaction::CheckTransaction(CValidationState &state, uint256 hashTx, boo\n \n                                 // CHECK PUBCOIN ID\n                                 int pubcoinId = txin.nSequence;\n+                                //printf("====================== pubcoinId = %d\\n", pubcoinId);\n                                 if (pubcoinId < 1 && pubcoinId == INT_MAX) { // IT BEGINS WITH 1\n                                     return state.DoS(100, error("CTransaction::CheckTransaction() : Error: nSequence is not correct format"));\n                                 }\n@@ -2240,8 +2241,8 @@ unsigned int ComputeMinWork(unsigned int nBase, int64 nTime)\n {\n     // Testnet has min-difficulty blocks\n     // after nTargetSpacing*16 time between blocks:\n-    //if (fTestNet && nTime > nTargetSpacing*16)\n-    //    return bnProofOfWorkLimit.GetCompact();\n+    if (fTestNet && nTime > nTargetSpacing*3)\n+        return bnProofOfWorkLimit.GetCompact();\n \n     CBigNum bnResult;\n     bnResult.SetCompact(nBase);\n@@ -2361,14 +2362,13 @@ unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBl\n         uint32_t                                PastBlocksMin                                = PastSecondsMin / BlocksTargetSpacing; // 36 blocks\n         uint32_t                                PastBlocksMax                                = PastSecondsMax / BlocksTargetSpacing; // 1008 blocks\n         \n-/*    if (fTestNet) {\n-    // If the new block\'s timestamp is more than nTargetSpacing*16\n-    // then allow mining of a min-difficulty block.\n-        if (pblock->nTime > pindexLast->nTime + nTargetSpacing*16)\n-        {\n+    if (fTestNet) {\n+        // If the new block\'s timestamp is more than nTargetSpacing*6\n+    // then allow mining of a min-difficulty block\n+        if (pblock->nTime > pindexLast->nTime + nTargetSpacing*6) {\n             return bnProofOfWorkLimit.GetCompact();\n         }\n-    }*/\n+    }\n \n     // 9/29/2016 - Reset to Lyra2(2,block_height,256) due to ASIC KnC Miner Scrypt\n     // 36 block look back, reset to mininmun diff\n@@ -2378,11 +2378,12 @@ unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBl\n \n     }\n \n+    /*\n     if(fTestNet && pindexLast->nHeight + 1 >= 138 && pindexLast->nHeight + 1 <= 173){\n \n         return bnProofOfWorkLimit.GetCompact();\n \n-    }\n+    }*/\n \n     \n    \tif ((pindexLast->nHeight+1) % nInterval != 0) // Retarget every nInterval blocks \n@@ -3189,7 +3190,7 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)\n                             pubCoinTx.value = pubCoinItem.value;\n                             pubCoinTx.nHeight = -1;\n                             walletdb.WriteZerocoinEntry(pubCoinTx);\n-                            printf("- Connect Reset Pubcoin Id: %d Height: %d\\n", pubCoinTx.id, pindex->nHeight);\n+                            printf("- Connect Reset Pubcoin Denomination: %d Pubcoin Id: %d Height: %d\\n", pubCoinTx.denomination, pubCoinTx.id, pindex->nHeight);\n                             zercoinMintHeight = pindex->nHeight;\n                         }\n                     }\n@@ -3205,7 +3206,7 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)\n                             pubCoinTx.serialNumber = pubCoinItem.serialNumber;\n                             pubCoinTx.value = pubCoin;\n                             pubCoinTx.nHeight = -1;\n-                            printf("- Connect Reset Pubcoin Id: %d Height: %d\\n", pubCoinTx.id, pubCoinItem.nHeight);\n+                            printf("- Connect Reset Pubcoin Denomination: %d Pubcoin Id: %d Height: %d\\n", pubCoinTx.denomination, pubCoinTx.id, pindex->nHeight);\n                             walletdb.WriteZerocoinEntry(pubCoinTx);\n                         }\n \n@@ -3272,7 +3273,7 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)\n                                 if (currentId == countItemPubcoin.id && countItemPubcoin.denomination == pubCoinItem.denomination) {\n                                     countExistingItems++;\n                                 }\n-                                //printf("pubCoinItem.id = %d\\n", countItemPubcoin.id);\n+                                printf("pubCoinItem.id = %d\\n", countItemPubcoin.id);\n                             }\n \n                             // IF IT IS NOT 10 -> ADD MORE\n@@ -3290,7 +3291,7 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)\n                             pubCoinTx.serialNumber = pubCoinItem.serialNumber;\n                             pubCoinTx.value = pubCoinItem.value;\n                             pubCoinTx.nHeight = pindex->nHeight;\n-                            printf("REORG PUBCOIN ID: %d HEIGHT: %d\\n", pubCoinTx.id, pubCoinTx.nHeight);\n+                            printf("REORG PUBCOIN DENOMINATION: %d PUBCOIN ID: %d HEIGHT: %d\\n", pubCoinTx.denomination, pubCoinTx.id, pubCoinTx.nHeight);\n                             walletdb.WriteZerocoinEntry(pubCoinTx);\n                         }\n                     }\n@@ -6360,6 +6361,7 @@ void static ZcoinMiner(CWallet *pwallet)\n     unsigned int nExtraNonce = 0;\n \n     try { loop {\n+\n         while (vNodes.empty())\n             MilliSleep(1000);\n \n@@ -6406,21 +6408,23 @@ void static ZcoinMiner(CWallet *pwallet)\n             {\n                 if ( (!fTestNet && pindexPrev->nHeight + 1 >= 20500) ) {\n                     lyra2z_hash(BEGIN(pblock->nVersion), BEGIN(thash));\n-                } else if (fTestNet && pindexPrev->nHeight + 1 >= 3) { // for testnet\n+                } else if (fTestNet && pindexPrev->nHeight + 1 >= 500) { // for testnet\n                     lyra2z_hash(BEGIN(pblock->nVersion), BEGIN(thash));\n-                    printf("thash: %s\\n", thash.ToString().c_str());\n-                    printf("hashTarget: %s\\n", hashTarget.ToString().c_str());\n+                    //printf("lyra2z thash: %s\\n", thash.ToString().c_str());\n                 } else if( !fTestNet && pindexPrev->nHeight + 1 >= 8192){\n                     LYRA2(BEGIN(thash), 32, BEGIN(pblock->nVersion), 80, BEGIN(pblock->nVersion), 80, 2, 8192, 256);\n                 } else if( !fTestNet && pindexPrev->nHeight + 1 >= 500){\n                     LYRA2(BEGIN(thash), 32, BEGIN(pblock->nVersion), 80, BEGIN(pblock->nVersion), 80, 2, pindexPrev->nHeight + 1, 256);\n-//                }else if(fTestNet && pindexPrev->nHeight + 1 >= 138){\n-//                    LYRA2(BEGIN(thash), 32, BEGIN(pblock->nVersion), 80, BEGIN(pblock->nVersion), 80, 2, pindexPrev->nHeight + 1, 256);\n+                }else if(fTestNet && pindexPrev->nHeight + 1 >= 138){\n+                    LYRA2(BEGIN(thash), 32, BEGIN(pblock->nVersion), 80, BEGIN(pblock->nVersion), 80, 2, pindexPrev->nHeight + 1, 256);\n+                    printf("LYRA2 thash: %s\\n", thash.ToString().c_str());\n                 } else{\n                     unsigned long int scrypt_scratpad_size_current_block = ((1 << (GetNfactor(pblock->nTime) + 1)) * 128 ) + 63;\n                     char scratchpad[scrypt_scratpad_size_current_block];\n                     scrypt_N_1_1_256_sp_generic(BEGIN(pblock->nVersion), BEGIN(thash), scratchpad, GetNfactor(pblock->nTime));\n+                    printf("scrypt thash: %s\\n", thash.ToString().c_str());\n                 }\n+                //printf("hashTarget: %s\\n", hashTarget.ToString().c_str());\n \n                 if (thash <= hashTarget)\n                 {\ndiff --git a/src/main.h b/src/main.h\nindex 5ee9299a4..438916f1d 100755\n--- a/src/main.h\n+++ b/src/main.h\n@@ -1360,14 +1360,14 @@ public:\n \n         if (!fTestNet && height >= 20500) {\n             lyra2z_hash(BEGIN(nVersion), BEGIN(thash));\n-        } else if (fTestNet && height >= 3) { // for testnet\n+        } else if (fTestNet && height >= 500) { // for testnet\n             lyra2z_hash(BEGIN(nVersion), BEGIN(thash));\n         } else if( !fTestNet && height >= 8192){\n             LYRA2(BEGIN(thash), 32, BEGIN(nVersion), 80, BEGIN(nVersion), 80, 2, 8192, 256);\n         }else if( !fTestNet && height >= 500){\n             LYRA2(BEGIN(thash), 32, BEGIN(nVersion), 80, BEGIN(nVersion), 80, 2, height, 256);\n-        //}else if(fTestNet && height >= 138){\n-        //    LYRA2(BEGIN(thash), 32, BEGIN(nVersion), 80, BEGIN(nVersion), 80, 2, height, 256);\n+        }else if(fTestNet && height >= 138){\n+            LYRA2(BEGIN(thash), 32, BEGIN(nVersion), 80, BEGIN(nVersion), 80, 2, height, 256);\n         }else{\n             scrypt_N_1_1_256(BEGIN(nVersion), BEGIN(thash), GetNfactor(nTime));\n         }\ndiff --git a/src/rpcmining.cpp b/src/rpcmining.cpp\nindex 59b5d1aed..54ecb9484 100755\n--- a/src/rpcmining.cpp\n+++ b/src/rpcmining.cpp\n@@ -389,10 +389,14 @@ Value getwork(const Array& params, bool fHelp)\n     {\n         // Parse parameters\n         vector<unsigned char> vchData = ParseHex(params[0].get_str());\n-        if (vchData.size() != 128)\n+        for(int i = 0; i < 4; i++)\n+        {\n+            vchData.insert(vchData.begin(), 0);\n+        }\n+\n+        if (vchData.size() != 132)\n             throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter");\n         CBlock* pdata = (CBlock*)&vchData[0];\n-\n         // Byte reverse\n         for (int i = 0; i < 128/4; i++)\n             ((unsigned int*)pdata)[i] = ByteReverse(((unsigned int*)pdata)[i]);\ndiff --git a/src/version.h b/src/version.h\nindex 962e46f81..b276b580d 100755\n--- a/src/version.h\n+++ b/src/version.h\n@@ -25,7 +25,7 @@ extern const std::string CLIENT_DATE;\n // network protocol versioning\n //\n \n-static const int PROTOCOL_VERSION = 90019;\n+static const int PROTOCOL_VERSION = 90020;\n \n // intial proto version, to be increased after version/verack negotiation\n static const int INIT_PROTO_VERSION = 90013;\n', 'commit_subject': 'Merge pull request #57 from zcoinofficial/Lyra2Z', 'repo_name': 'zcoinofficial/zcoin', 'committer': {'name': 'GitHub', 'email': '1505422b2465e9a84f6fdfaa161078890c593f06@github.com', 'time_sec': '1486430005', 'tz_offset': '60', 'date': {'seconds': '1486430005'}}, 'commit_tree': '4fc0dc54529c17757481236aab97c0de083f806a', 'commit_message': 'Merge pull request #57 from zcoinofficial/Lyra2Z\n\nFinal Lyra2Z', 'language_name': 'Java', 'license': 'mit', 'hunks': '@@ -25,7 +25,7 @@ extern const std::string CLIENT_DATE;\n // network protocol versioning\n //\n \n-static const int PROTOCOL_VERSION = 90019;\n+static const int PROTOCOL_VERSION = 90020;\n \n // intial proto version, to be increased after version/verack negotiation\n static const int INIT_PROTO_VERSION = 90013;\n', 'addition_count': 1, 'deletion_count': 1, 'src_file': 'a/src/version.h', 'tgt_file': 'b/src/version.h', 'file_extension': '.h', 'before_file': '// Copyright (c) 2012-2016 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#ifndef BITCOIN_VERSION_H\n#define BITCOIN_VERSION_H\n\n/**\n * network protocol versioning\n */\n\nstatic const int PROTOCOL_VERSION = 90031;\n\n//! legacy znode protocol version\nstatic const int LEGACY_ZNODES_PROTOCOL_VERSION = 90026;\n\n//! initial proto version, to be increased after version/verack negotiation\nstatic const int INIT_PROTO_VERSION = 90013;\n\n//! In this version, \'getheaders\' was introduced.\nstatic const int GETHEADERS_VERSION = 90020;\n\n//! disconnect from peers older than this proto version\nstatic const int MIN_PEER_PROTO_VERSION = 90030;\n// network protocol versioning\n//\n\nstatic const int PROTOCOL_VERSION = 90019;\n\n// intial proto version, to be increased after version/verack negotiation\nstatic const int INIT_PROTO_VERSION = 90013;\n\n//! BIP 0031, pong message, is enabled for all versions AFTER this one\nstatic const int BIP0031_VERSION = 90013;\n\n//! "mempool" command, enhanced "getdata" behavior starts with this version\nstatic const int MEMPOOL_GD_VERSION = 90013;\n\n//! "filter*" commands are disabled without NODE_BLOOM after and including this version\nstatic const int NO_BLOOM_VERSION = 90013;\n\n//! "sendheaders" command and announcing blocks with headers starts with this version\nstatic const int SENDHEADERS_VERSION = 90013;\n\n//! "feefilter" tells peers to filter invs to you by fee starts with this version\nstatic const int FEEFILTER_VERSION = 90013;\n\n//! shord-id-based block download starts with this version\nstatic const int SHORT_IDS_BLOCKS_VERSION = 90013;\n\n//! not banning for invalid compact blocks starts with this version\nstatic const int INVALID_CB_NO_BAN_VERSION = 90013;\n\n//! minimum version of official client to connect to\nstatic const int MIN_FIRO_CLIENT_VERSION = 141000; // 0.14.10.0\n\n//! introduction of DIP3/deterministic masternodes\nstatic const int DMN_PROTO_VERSION = 90030;\n\n//! introduction of LLMQs\nstatic const int LLMQS_PROTO_VERSION = 90030;\n\n//! introducing blocks with stripped MTP data\nstatic const int MTPDATA_STRIPPED_VERSION = 90031;\n\n#endif // BITCOIN_VERSION_H\n', 'message': 'Merge pull request #57 from zcoinofficial/Lyra2Z\n\nFinal Lyra2Z', 'author_name': 'GitHub', 'lang': 'h'}