diff --git a/doc/assets-attribution.txt b/doc/assets-attribution.txt index a905074..9468a05 100644 --- a/doc/assets-attribution.txt +++ b/doc/assets-attribution.txt @@ -49,11 +49,6 @@ Designer: Everaldo (Everaldo Coelho) License: GNU/GPL Site: http://findicons.com/icon/17102/reload?id=17102 -Image: src/qt/res/images/splash2.jpg (Wallet image) -Designer: Crobbo (forum), adapted to Litecoin by BitcoinPorn (forum) -Site: https://bitcointalk.org/index.php?topic=32273.0, https://bitcointalk.org/index.php?topic=47417.msg591988#msg591988 -License: Public domain - Icon: src/qt/res/icons/debugwindow.png Designer: Vignoni David Site: http://www.oxygen-icons.org/ diff --git a/src/clientversion.h b/src/clientversion.h index 480fb25..a2df6b3 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -11,6 +11,7 @@ #define CLIENT_VERSION_REVISION 5 #define CLIENT_VERSION_BUILD 1 + // Converts the parameter X to a string after macro replacement on X has been performed. // Don't merge these into one macro! #define STRINGIZE(X) DO_STRINGIZE(X) diff --git a/src/main.cpp b/src/main.cpp index e254577..bb71550 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1022,16 +1022,9 @@ int64 GetProofOfWorkReward(int nHeight, int64 nFees, uint256 prevHash) else if (nHeight < 4835520){ nSubsidy = 0.000003 * COIN; } - else if (nHeight < 5045760){ - nSubsidy = 0.000001 * COIN; - } - else if (nHeight == 5045760){ - nSubsidy = 0.000001 * COIN; - } - else if (nHeight > 5045760){ + else { nSubsidy = 0.000001 * COIN; } - return nSubsidy + nFees; } @@ -1045,6 +1038,7 @@ int64 GetProofOfStakeReward(int64 nCoinAge, unsigned int nBits, unsigned int nTi // Stage 2 of emission process is PoS-based. It will be active on mainNet since 20 Jun 2013. CBigNum bnRewardCoinYearLimit = MAX_MINT_PROOF_OF_STAKE; // Base stake mint rate, 100% year interest + if (nBestHeight > (int)HF_BLOCK) bnRewardCoinYearLimit = (int)4 * MAX_MINT_PROOF_OF_STAKE; // 4% hardfork CBigNum bnTarget; bnTarget.SetCompact(nBits); CBigNum bnTargetLimit = bnProofOfStakeLimit; @@ -1059,6 +1053,7 @@ int64 GetProofOfStakeReward(int64 nCoinAge, unsigned int nBits, unsigned int nTi // nRewardCoinYear = 1 / (posdiff ^ 1/4) CBigNum bnLowerBound = 1 * CENT; // Lower interest bound is 1% per year + if (nBestHeight > (int)HF_BLOCK) bnLowerBound = 4 * CENT; CBigNum bnUpperBound = bnRewardCoinYearLimit; while (bnLowerBound + CENT <= bnUpperBound) { @@ -1071,7 +1066,8 @@ int64 GetProofOfStakeReward(int64 nCoinAge, unsigned int nBits, unsigned int nTi bnLowerBound = bnMidValue; } nRewardCoinYear = bnUpperBound.getuint64(); - nRewardCoinYear = min(nRewardCoinYear, MAX_MINT_PROOF_OF_STAKE); + if (nBestHeight > (int)HF_BLOCK) min(nRewardCoinYear, (int)4 * MAX_MINT_PROOF_OF_STAKE); // 4% hardfork + else nRewardCoinYear = min(nRewardCoinYear, MAX_MINT_PROOF_OF_STAKE); int64 nSubsidy = nRewardCoinYear * nCoinAge * 33 / (365 * 33 + 8) ; @@ -1083,7 +1079,8 @@ int64 GetProofOfStakeReward(int64 nCoinAge, unsigned int nBits, unsigned int nTi } static const int64 nTargetTimespan = 4 * 60 * 60; // 4-hour -static const int64 nTargetSpacingWorkMax = 12 * nStakeTargetSpacing; // 2-hour +void loop() { if (nBestHeight > (int)HF_BLOCK) nStakeTargetSpacing = 4 * 60; /* 4 minute target enforced */ } +static const int64 nTargetSpacingWorkMax = 12 * nStakeTargetSpacing; // 2-hour // 48 min if 'if' above true // // minimum amount of work that could possibly be required nTime after @@ -1171,6 +1168,7 @@ unsigned int static GetNextTargetRequired(const CBlockIndex* pindexLast, bool fP // ppcoin: retarget with exponential moving toward target spacing CBigNum bnNew; bnNew.SetCompact(pindexPrev->nBits); + if (pindexLast->nHeight > (int)HF_BLOCK) nStakeTargetSpacing = 4 * 60; // 4 minute target enforced int64 nTargetSpacing = fProofOfStake? nStakeTargetSpacing : min(nTargetSpacingWorkMax, (int64) nStakeTargetSpacing * (1 + pindexLast->nHeight - pindexPrev->nHeight)); int64 nInterval = nTargetTimespan / nTargetSpacing; bnNew *= ((nInterval - 1) * nTargetSpacing + nActualSpacing + nActualSpacing); @@ -2001,6 +1999,7 @@ bool CTransaction::GetCoinAge(CTxDB& txdb, uint64& nCoinAge) const CBlock block; if (!block.ReadFromDisk(txindex.pos.nFile, txindex.pos.nBlockPos, false)) return false; // unable to read block of previous transaction + if ( nBestHeight > (int)HF_BLOCK ) nStakeMinAge = 60 * 60; // 1 hour hotwire * 24 * 4; // 4 day min stake age hardfork if (block.GetBlockTime() + nStakeMinAge > nTime) continue; // only count coins meeting min age requirement @@ -2212,6 +2211,10 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot) const bool CBlock::AcceptBlock() { + // check version + if (nVersion > CURRENT_VERSION) + return DoS(100, error("AcceptBlock() : reject unknown block version %d", nVersion)); + // Check for duplicate uint256 hash = GetHash(); if (mapBlockIndex.count(hash)) @@ -2224,6 +2227,9 @@ bool CBlock::AcceptBlock() CBlockIndex* pindexPrev = (*mi).second; int nHeight = pindexPrev->nHeight+1; + if (IsProofOfWork() && nHeight > (int)HF_BLOCK) + return DoS(100, error("AcceptBlock() : rejected pow block at height %d", nHeight)); + // Check proof-of-work or proof-of-stake if (nBits != GetNextTargetRequired(pindexPrev, IsProofOfStake())) return DoS(100, error("AcceptBlock() : incorrect %s", IsProofOfWork() ? "proof-of-work" : "proof-of-stake")); @@ -2648,7 +2654,10 @@ bool LoadBlockIndex(bool fAllowNew) block.nTime = nChainStartTime;; block.nBits = bnProofOfWorkLimit.GetCompact(); block.nNonce = 25338; - + if (fTestNet) + { + block.nNonce = 12577; + } if (IsCalculatingGenesisBlockHash && (block.GetHash() != hashGenesisBlock)) { block.nNonce = 0; @@ -2870,7 +2879,7 @@ bool LoadExternalBlockFile(FILE* fileIn) extern map mapAlerts; extern CCriticalSection cs_mapAlerts; -static string strMintMessage = "Info: Staking suspended due to locked wallet. Click 'Settings' then 'Unlock Wallet' to stake."; +static string strMintMessage = "Click 'Settings' then 'Unlock Wallet' to stake."; static string strMintWarning; string GetWarnings(string strFor) @@ -3346,6 +3355,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) printf(" getblocks stopping at %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString().substr(0,20).c_str()); // ppcoin: tell downloading node about the latest block if it's // without risk being rejected due to stake connection check + if ( nBestHeight > (int)HF_BLOCK ) nStakeMinAge = 60 * 60 * 24 * 4; // 4 day min stake age hardfork if (hashStop != hashBestChain && pindex->GetBlockTime() + nStakeMinAge > pindexBest->GetBlockTime()) pfrom->PushInventory(CInv(MSG_BLOCK, hashBestChain)); break; @@ -4481,7 +4491,7 @@ void curecoinMiner(CWallet *pwallet, bool fProofOfStake) while (pwallet->IsLocked()) { - strMintWarning = strMintMessage; + //strMintWarning = strMintMessage; Sleep(1000); } strMintWarning = ""; diff --git a/src/main.h b/src/main.h index 4ea33c0..5c5e743 100644 --- a/src/main.h +++ b/src/main.h @@ -36,6 +36,7 @@ static const int64 MAX_MINT_PROOF_OF_WORK = 13 * COIN; //Lucky number 13 Coins p static const int64 MAX_MINT_PROOF_OF_STAKE = 0.01 * MAX_MINT_PROOF_OF_WORK; //1% annual interest reward the folders and holders static const int64 MIN_TXOUT_AMOUNT = MIN_TX_FEE; static const unsigned int MAX_TX_COMMENT_LEN = 268; // curecoin: 256 bytes + 12 little extra +static const unsigned int HF_BLOCK = 12961; // testing hotwire 220000; // hardfork's block height inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); } // Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp. @@ -48,7 +49,7 @@ static const int fHaveUPnP = false; #endif static const uint256 hashGenesisBlockOfficial("0x00000ce427729d5393dbf9f464e7a1d2c039e393e881f93448516b1530b688fc"); -static const uint256 hashGenesisBlockTestNet("0x"); +static const uint256 hashGenesisBlockTestNet("0x0000a25934ca63ddc77adf8fe033cfb5f847e5687943ad717bb95ff041a74eb7"); static const int64 nMaxClockDrift = 2 * 60 * 60; // two hours diff --git a/src/net.cpp b/src/net.cpp index 7d47dac..3528d66 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1886,10 +1886,10 @@ void StartNode(void* parg) // ppcoin: mint proof-of-stake blocks in the background if (!GetBoolArg("-staking", true)) - printf("Staking disabled\n"); + printf("Staking disabled\n"); else - if (!NewThread(ThreadStakeMinter, pwalletMain)) - printf("Error: NewThread(ThreadStakeMinter) failed\n"); + if (!NewThread(ThreadStakeMinter, pwalletMain)) + printf("Error: NewThread(ThreadStakeMinter) failed\n"); // Generate coins in the background Generatecurecoins(GetBoolArg("-gen", false), pwalletMain); diff --git a/src/qt/curecoin.cpp b/src/qt/curecoin.cpp index 10d3919..4251b1c 100644 --- a/src/qt/curecoin.cpp +++ b/src/qt/curecoin.cpp @@ -196,7 +196,10 @@ int main(int argc, char *argv[]) return 1; } - QSplashScreen splash(QPixmap(":/images/splash"), 0); + QString splashPath; + if (GetBoolArg("-testnet")) splashPath=":/images/splash_testnet"; + else splashPath=":/images/splash"; + QSplashScreen splash(QPixmap(splashPath), 0); if (GetBoolArg("-splash", true) && !GetBoolArg("-min")) { splash.show(); diff --git a/src/qt/curecoin.qrc b/src/qt/curecoin.qrc index 819ad34..118801c 100644 --- a/src/qt/curecoin.qrc +++ b/src/qt/curecoin.qrc @@ -45,7 +45,8 @@ res/images/about.png - res/images/splash2.jpg + res/images/splash.jpg + res/images/splash_testnet.jpg res/images/wallet_bgcoin.png @@ -71,8 +72,8 @@ locale/curecoin_es_CL.qm locale/curecoin_et.qm locale/curecoin_eu_ES.qm - locale/curecoin_fa.qm - locale/curecoin_fa_IR.qm + locale/curecoin_fa.qm + locale/curecoin_fa_IR.qm locale/curecoin_fi.qm locale/curecoin_fr.qm locale/curecoin_fr_CA.qm diff --git a/src/qt/curecoinunits.cpp b/src/qt/curecoinunits.cpp index 69c7930..cca0aea 100644 --- a/src/qt/curecoinunits.cpp +++ b/src/qt/curecoinunits.cpp @@ -45,9 +45,9 @@ QString curecoinUnits::description(int unit) { switch(unit) { - case BTC: return QString("curecoins"); - case mBTC: return QString("Milli-curecoins (1 / 1,000)"); - case uBTC: return QString("Micro-curecoins (1 / 1,000,000)"); + case BTC: return QString("Curecoins"); + case mBTC: return QString("Milli-Curecoins (1 / 1,000)"); + case uBTC: return QString("Micro-Curecoins (1 / 1,000,000)"); default: return QString("???"); } } diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index 1528867..e14ff54 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -55,7 +55,7 @@ 0 0 666 - 145 + 143 diff --git a/src/qt/res/curecoin-qt.rc b/src/qt/res/curecoin-qt.rc index afecb87..91e4eb7 100644 --- a/src/qt/res/curecoin-qt.rc +++ b/src/qt/res/curecoin-qt.rc @@ -18,14 +18,14 @@ BEGIN BEGIN BLOCK "040904E4" // U.S. English - multilingual (hex) BEGIN - VALUE "CompanyName", "curecoin" - VALUE "FileDescription", "curecoin-Qt (OSS GUI client for curecoin)" + VALUE "CompanyName", "Curecoin" + VALUE "FileDescription", "Curecoin-Qt (OSS GUI client for curecoin)" VALUE "FileVersion", VER_FILEVERSION_STR VALUE "InternalName", "curecoin-qt" - VALUE "LegalCopyright", "2009-2012 The Bitcon developers, 2012-2013 The curecoin & PPCoin developers, 2003 The curecoin developer" + VALUE "LegalCopyright", "2014-2018 Curecoin developers, 2009-2012 Bitcoin developers, 2012-2013 PPCoin developers" VALUE "LegalTrademarks1", "Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." VALUE "OriginalFilename", "curecoin-qt.exe" - VALUE "ProductName", "curecoin-Qt" + VALUE "ProductName", "Curecoin-Qt" VALUE "ProductVersion", VER_PRODUCTVERSION_STR END END diff --git a/src/qt/res/images/splash2.jpg b/src/qt/res/images/splash.jpg similarity index 100% rename from src/qt/res/images/splash2.jpg rename to src/qt/res/images/splash.jpg diff --git a/src/qt/res/images/splash_testnet.jpg b/src/qt/res/images/splash_testnet.jpg new file mode 100644 index 0000000..eaec3bf Binary files /dev/null and b/src/qt/res/images/splash_testnet.jpg differ diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 6dab5e8..91f08aa 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2013 The curecoin developer +// Copyright (c) 2013 The Curecoin developer // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -165,10 +165,10 @@ Value getworkex(const Array& params, bool fHelp) ); if (vNodes.empty()) - throw JSONRPCError(-9, "curecoin is not connected!"); + throw JSONRPCError(-9, "Curecoin is not connected!"); if (IsInitialBlockDownload()) - throw JSONRPCError(-10, "curecoin is downloading blocks..."); + throw JSONRPCError(-10, "Curecoin is downloading blocks..."); typedef map > mapNewBlock_t; static mapNewBlock_t mapNewBlock; @@ -299,10 +299,10 @@ Value getwork(const Array& params, bool fHelp) "If [data] is specified, tries to solve the block and returns true if it was successful."); if (vNodes.empty()) - throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "curecoin is not connected!"); + throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Curecoin is not connected!"); if (IsInitialBlockDownload()) - throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "curecoin is downloading blocks..."); + throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Curecoin is downloading blocks..."); typedef map > mapNewBlock_t; static mapNewBlock_t mapNewBlock; // FIXME: thread safety @@ -443,10 +443,10 @@ Value getblocktemplate(const Array& params, bool fHelp) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); if (vNodes.empty()) - throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "curecoin is not connected!"); + throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Curecoin is not connected!"); if (IsInitialBlockDownload()) - throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "curecoin is downloading blocks..."); + throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Curecoin is downloading blocks..."); static CReserveKey reservekey(pwalletMain); diff --git a/src/util.cpp b/src/util.cpp index 5d0d9de..89a46e7 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1062,7 +1062,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) path = GetDefaultDataDir(); } if (fNetSpecific && GetBoolArg("-testnet", false)) - path /= "testnet2"; + path /= "testnet"; fs::create_directory(path); diff --git a/src/version.cpp b/src/version.cpp index 2305ad2..c5a215a 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -11,7 +11,7 @@ const std::string CLIENT_NAME("Curecoin"); // Client version number -#define CLIENT_VERSION_SUFFIX "-CUR" +#define CLIENT_VERSION_SUFFIX "-CURE" // The following part of the code determines the CLIENT_BUILD variable. diff --git a/src/version.h b/src/version.h index f79417d..dc86c1a 100644 --- a/src/version.h +++ b/src/version.h @@ -44,9 +44,9 @@ static const int BIP0031_VERSION = 60000; // "mempool" command, enhanced "getdata" behavior starts with this version: static const int MEMPOOL_GD_VERSION = 60002; -#define DISPLAY_VERSION_MAJOR 1 -#define DISPLAY_VERSION_MINOR 9 -#define DISPLAY_VERSION_REVISION 5 +#define DISPLAY_VERSION_MAJOR 2 +#define DISPLAY_VERSION_MINOR 0 +#define DISPLAY_VERSION_REVISION 0 #define DISPLAY_VERSION_BUILD 1 #endif