diff --git a/COPYING b/COPYING index b3a7b7300d..f788832a4a 100755 --- a/COPYING +++ b/COPYING @@ -1,5 +1,5 @@ Copyright (c) 2009-2013 Bitcoin Developers -Copyright (c) 2011-2013 zcoin Developers +Copyright (c) 2015-2017 zcoin Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 0add7f5b13..807ceddb2d 100755 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ https://zcoin.finance/ Copyright (c) 2009 - 2016 Bitcoin Developers - Copyright (c) 2015 - 2016 ZCoin Developers + Copyright (c) 2015 - 2017 ZCoin Developers What is ZCoin? ---------------- diff --git a/contrib/homebrew/makefile.osx.patch b/contrib/homebrew/makefile.osx.patch index 287db2fdf2..26215585c3 100755 --- a/contrib/homebrew/makefile.osx.patch +++ b/contrib/homebrew/makefile.osx.patch @@ -22,7 +22,7 @@ index bef0ef3..07ef8d3 100644 LIBPATHS= \ -L"$(DEPSDIR)/lib" \ -- -L"$(DEPSDIR)/lib/db48" +- -L"$(DEPSDIR)/opt/berkeley-db4/lib" + -L"$(DB4DIR)/lib" \ + -L"$(OPENSSLDIR)/lib" @@ -46,3 +46,4 @@ index bef0ef3..07ef8d3 100644 -lz else TESTLIBS += \ + diff --git a/contrib/macdeploy/background.png b/contrib/macdeploy/background.png old mode 100755 new mode 100644 index 837ad576d6..2d7d1d2c22 Binary files a/contrib/macdeploy/background.png and b/contrib/macdeploy/background.png differ diff --git a/doc/build-osx.md b/doc/build-osx.md index 2742bad307..6300d0828d 100755 --- a/doc/build-osx.md +++ b/doc/build-osx.md @@ -1,35 +1,15 @@ -Mac OS X zcoind build instructions +Mac OS X Daemon Build Instructions and Notes ==================================== -Authors -------- - -* Laszlo Hanyecz -* Douglas Huff -* Colin Dean -* Gavin Andresen - -License -------- - -Copyright (c) 2009-2012 Bitcoin Developers - -Distributed under the MIT/X11 software license, see the accompanying -file COPYING or http://www.opensource.org/licenses/mit-license.php. - -This product includes software developed by the OpenSSL Project for use in -the OpenSSL Toolkit (http://www.openssl.org/). - -This product includes cryptographic software written by -Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard. +* Modified by Aizen Sou (aizen0sou@gmail.com) @ 2017 Notes ----- -See `doc/readme-qt.rst` for instructions on building zcoin, the +See `doc/readme-qt.rst` for instructions on building zcoin-qt, the graphical user interface. -Tested on OS X 10.5 through 10.8 on Intel processors only. PPC is not +Tested on OS X 10.7 through 10.12 on Intel processors only. PPC is not supported because it is big-endian. All of the commands should be executed in a Terminal application. The @@ -38,96 +18,41 @@ built-in one is located in `/Applications/Utilities`. Preparation ----------- -You need to install XCode with all the options checked so that the compiler -and everything is available in /usr not just /Developer. XCode should be -available on your OS X installation media, but if not, you can get the -current version from https://developer.apple.com/xcode/. If you install -Xcode 4.3 or later, you'll need to install its command line tools. This can -be done in `Xcode > Preferences > Downloads > Components` and generally must -be re-done or updated every time Xcode is updated. - -There's an assumption that you already have `git` installed, as well. If -not, it's the path of least resistance to install [Github for Mac](https://mac.github.com/) -(OS X 10.7+) or -[Git for OS X](https://code.google.com/p/git-osx-installer/). It is also -available via Homebrew or MacPorts. - -You will also need to install [Homebrew](http://mxcl.github.io/homebrew/) -or [MacPorts](https://www.macports.org/) in order to install library -dependencies. It's largely a religious decision which to choose, but, as of -December 2012, MacPorts is a little easier because you can just install the -dependencies immediately - no other work required. If you're unsure, read -the instructions through first in order to assess what you want to do. -Homebrew is a little more popular among those newer to OS X. - -The installation of the actual dependencies is covered in the Instructions -sections below. - -Instructions: MacPorts ----------------------- - -### Install dependencies +Install the OS X command line tools: -Installing the dependencies using MacPorts is very straightforward. + xcode-select --install - sudo port install boost db48@+no_java openssl miniupnpc +When the popup appears, click Install. -### Building `zcoind` - -1. Clone the github tree to get the source code and go into the directory. - - git clone git@github.com:zcoin/zcoin.git zcoin - cd zcoin - -2. Build zcoind: - - cd src - make -f makefile.osx - -3. It is a good idea to build and run the unit tests, too: - - make -f makefile.osx test +You will also need to install [Homebrew](http://mxcl.github.io/homebrew/) -Instructions: HomeBrew +Dependencies ---------------------- -#### Install dependencies using Homebrew + brew install automake berkeley-db4 libtool boost --c++11 miniupnpc openssl pkg-config --c++11 qt5 - brew install boost miniupnpc openssl berkeley-db4 - -Note: After you have installed the dependencies, you should check that the Brew installed version of OpenSSL is the one available for compilation. You can check this by typing - - openssl version - -into Terminal. You should see OpenSSL 1.0.1e 11 Feb 2013. - -If not, you can ensure that the Brew OpenSSL is correctly linked by running +If you have trouble with linking openssl you can ensure that the Brew OpenSSL is correctly linked by running brew link openssl --force -Rerunning "openssl version" should now return the correct version. +Or manually by + cd /usr/local/include + ln -s ../opt/openssl/include/openssl . + ### Building `zcoind` 1. Clone the github tree to get the source code and go into the directory. - git clone git@github.com:zcoin/zcoin.git zcoin + git clone https://github.com/zcoinofficial/zcoin cd zcoin -2. Modify source in order to pick up the `openssl` library. - - Edit `makefile.osx` to account for library location differences. There's a - diff in `contrib/homebrew/makefile.osx.patch` that shows what you need to - change, or you can just patch by doing - - patch -p1 < contrib/homebrew/makefile.osx.patch - -3. Build zcoind: +2. Build zcoind: cd src make -f makefile.osx -4. It is a good idea to build and run the unit tests, too: +3. It is a good idea to build and run the unit tests, too: make -f makefile.osx test diff --git a/doc/readme-qt.rst b/doc/readme-qt.rst index 101af3a631..86422a7442 100755 --- a/doc/readme-qt.rst +++ b/doc/readme-qt.rst @@ -1,6 +1,8 @@ -zcoin: Qt4 GUI for zcoin +zcoin: Qt GUI for zcoin =============================== +Modified by Aizen Sou (aizen0sou@gmail.com) @ 2017 + Build instructions =================== @@ -47,37 +49,78 @@ An executable named `zcoin-qt` will be built. .. _`Qt Creator`: http://qt-project.org/downloads/ -Mac OS X --------- -- Download and install the `Qt Mac OS X SDK`_. It is recommended to also install Apple's Xcode with UNIX tools. +Ubuntu => 14.04 +------- + +First you have to install the dependencies +Qt4 dependencies : + +:: + + sudo apt-get install -y build-essential libssl-dev libboost-all-dev libqt4-dev libprotobuf-dev protobuf-compiler libqrencode-dev software-properties-common + -- Download and install either `MacPorts`_ or `HomeBrew`_. +Qt5 dependencies: -- Execute the following commands in a terminal to get the dependencies using MacPorts: +:: + + sudo apt-get install -y libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools + + +then execute the following: :: - sudo port selfupdate - sudo port install boost db48 miniupnpc + qmake "RELEASE=1" + make + + +If you have trouble with the taskbar doesn't show up in Ubuntu (It's an Unity's specific bug), you could try to fix it with giving this below command in the terminal to restart Unity +------- +:: + + initctl restart unity-panel-service + + +Mac OS X +-------- + +- Download and install the `Qt Mac OS X SDK`_. It is recommended to also install Apple's Xcode with UNIX tools. + +- Download and install `HomeBrew`_. - Execute the following commands in a terminal to get the dependencies using HomeBrew: :: brew update - brew install boost miniupnpc openssl berkeley-db4 + brew install automake berkeley-db4 libtool boost --c++11 miniupnpc openssl pkg-config --c++11 qt5 -- If using HomeBrew, edit `zcoin-qt.pro` to account for library location differences. There's a diff in `contrib/homebrew/bitcoin-qt-pro.patch` that shows what you need to change, or you can just patch by doing +- Make sure to enfore linking qmake in the Terminal.app + +:: - patch -p1 < contrib/homebrew/bitcoin.qt.pro.patch + brew link qt5 --force - Open the zcoin-qt.pro file in Qt Creator and build as normal (cmd-B) .. _`Qt Mac OS X SDK`: http://qt-project.org/downloads/ -.. _`MacPorts`: http://www.macports.org/install.php .. _`HomeBrew`: http://mxcl.github.io/homebrew/ +- Or using Terminal with: + +:: + + qmake "RELEASE=1" zcoin.pro + make + +- After that you could deploy the app with + +:: + + contrib/macdeploy/macdeployqtplus zcoin-qt.app -dmg -fancy contrib/macdeploy/fancy.plist -verbose 2 + Build configuration options ============================ diff --git a/src/alert.cpp b/src/alert.cpp index b1ebe36be2..67c37b0f67 100755 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -51,8 +51,8 @@ std::string CUnsignedAlert::ToString() const return strprintf( "CAlert(\n" " nVersion = %d\n" - " nRelayUntil = %"PRI64d"\n" - " nExpiration = %"PRI64d"\n" + " nRelayUntil = %" PRI64d"\n" + " nExpiration = %" PRI64d"\n" " nID = %d\n" " nCancel = %d\n" " setCancel = %s\n" diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index b2fb1e436b..6709dd323c 100755 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -365,7 +365,7 @@ static string HTTPReply(int nStatus, const string& strMsg, bool keepalive) "HTTP/1.1 %d %s\r\n" "Date: %s\r\n" "Connection: %s\r\n" - "Content-Length: %"PRIszu"\r\n" + "Content-Length: %" PRIszu"\r\n" "Content-Type: application/json\r\n" "Server: ZCoin-json-rpc/%s\r\n" "\r\n" diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index b167c4e217..23c49b7ebb 100755 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -35,12 +35,17 @@ namespace Checkpoints // + Contains no strange transactions static MapCheckpoints mapCheckpoints = boost::assign::map_list_of - ( 0, uint256("0xf11046292ff76af48b66de6f1a210c09825d2ab4f56975ec507766ebf9c9f443")) + (0, uint256("0xf11046292ff76af48b66de6f1a210c09825d2ab4f56975ec507766ebf9c9f443")) + (14000, uint256("0xeab9b7e451284cb75ada7609e0220bee2b4f289fed9d9cf2a9e3aa548b2d38eb")) + (14001, uint256("0x98641539b9b8ff4e6a8053ec904a14a99f95cf7655c71625104419b22016c9a0")) + (14002, uint256("0x8c8c67106b0b612b08edd13e846c97c24ad0b59066efdb3ad6666e20f90d4bfa")) + (14003, uint256("0xaccfa7c7bb153135def08bb54dadb1835744d9521afb36661a91aa2f70df9abd")) + (14271, uint256("0xf15088099a30f98e85a09789880f74cadca42f725c0cc1666484865539d2f335")) ; static const CCheckpointData data = { &mapCheckpoints, - 1402460085, // * UNIX timestamp of last checkpoint block - 1, // * total number of transactions between genesis and last checkpoint + 1483237488, // * UNIX timestamp of last checkpoint block + 74456, // * total number of transactions between genesis and last checkpoint // (the tx=... number in the SetBestChain debug.log lines) 1200.0 // * estimated number of transactions per day after checkpoint }; diff --git a/src/clientversion.h b/src/clientversion.h index 36d0ad7193..7d94122ee7 100755 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -16,7 +16,7 @@ // Copyright year (2009-this) // Todo: update this when changing our copyright comments in the source -#define COPYRIGHT_YEAR 2014 +#define COPYRIGHT_YEAR 2017 // Converts the parameter X to a string after macro replacement on X has been performed. // Don't merge these into one macro! diff --git a/src/db.cpp b/src/db.cpp index 2bda0659ba..d27aa165ab 100755 --- a/src/db.cpp +++ b/src/db.cpp @@ -456,7 +456,7 @@ void CDBEnv::Flush(bool fShutdown) else mi++; } - printf("DBFlush(%s)%s ended %15"PRI64d"ms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started", GetTimeMillis() - nStart); + printf("DBFlush(%s)%s ended %15" PRI64d"ms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " db not started", GetTimeMillis() - nStart); if (fShutdown) { char** listp; diff --git a/src/db.h b/src/db.h index ea440c4960..b12b4cf3ba 100755 --- a/src/db.h +++ b/src/db.h @@ -304,6 +304,8 @@ class CDB } bool static Rewrite(const std::string& strFile, const char* pszSkip = NULL); + + }; diff --git a/src/init.cpp b/src/init.cpp index 253b5e5f26..96e01353f4 100755 --- a/src/init.cpp +++ b/src/init.cpp @@ -3,6 +3,7 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include "db.h" #include "txdb.h" #include "walletdb.h" #include "bitcoinrpc.h" @@ -715,7 +716,7 @@ bool AppInit2(boost::thread_group& threadGroup) { // try moving the database env out of the way boost::filesystem::path pathDatabase = GetDataDir() / "database"; - boost::filesystem::path pathDatabaseBak = GetDataDir() / strprintf("database.%"PRI64d".bak", GetTime()); + boost::filesystem::path pathDatabaseBak = GetDataDir() / strprintf("database.%" PRI64d".bak", GetTime()); try { boost::filesystem::rename(pathDatabase, pathDatabaseBak); printf("Moved old %s to %s. Retrying.\n", pathDatabase.string().c_str(), pathDatabaseBak.string().c_str()); @@ -987,7 +988,7 @@ bool AppInit2(boost::thread_group& threadGroup) printf("Shutdown requested. Exiting.\n"); return false; } - printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart); + printf(" block index %15" PRI64d"ms\n", GetTimeMillis() - nStart); if (GetBoolArg("-printblockindex") || GetBoolArg("-printblocktree")) { @@ -1030,26 +1031,35 @@ bool AppInit2(boost::thread_group& threadGroup) bool fFirstRun = true; pwalletMain = new CWallet("wallet.dat"); + + + if (filesystem::exists(GetDataDir() / "wallet.dat")) { // Zerocoin reorg, calculate new height and id list listPubCoin = list(); CWalletDB walletdb(pwalletMain->strWalletFile); + int lastCalculatedZCBlock = 0; + walletdb.ReadCalculatedZCBlock(lastCalculatedZCBlock); walletdb.ListPubCoin(listPubCoin); // RECURSIVE, SET NEW ID BOOST_FOREACH(const CZerocoinEntry& pubCoinItem, listPubCoin) { - CZerocoinEntry pubCoinTx; - pubCoinTx.value = pubCoinItem.value; - pubCoinTx.id = -1; - pubCoinTx.randomness = pubCoinItem.randomness; - pubCoinTx.denomination = pubCoinItem.denomination; - pubCoinTx.serialNumber = pubCoinItem.serialNumber; - pubCoinTx.nHeight = -1; - pubCoinTx.IsUsed = pubCoinItem.IsUsed; - //printf("- Reindex Pubcoin Id: %d Denomination: %d\n", pubCoinTx.id, pubCoinTx.denomination); - walletdb.WriteZerocoinEntry(pubCoinTx); + if(pubCoinItem.nHeight < lastCalculatedZCBlock){ + continue; + }else{ + CZerocoinEntry pubCoinTx; + pubCoinTx.value = pubCoinItem.value; + pubCoinTx.id = -1; + pubCoinTx.randomness = pubCoinItem.randomness; + pubCoinTx.denomination = pubCoinItem.denomination; + pubCoinTx.serialNumber = pubCoinItem.serialNumber; + pubCoinTx.nHeight = -1; + pubCoinTx.IsUsed = pubCoinItem.IsUsed; + //printf("- Reindex Pubcoin Id: %d Denomination: %d\n", pubCoinTx.id, pubCoinTx.denomination); + walletdb.WriteZerocoinEntry(pubCoinTx); + } } @@ -1057,74 +1067,83 @@ bool AppInit2(boost::thread_group& threadGroup) { while (pindexRecur) { - CBlock blockRecur; - blockRecur.ReadFromDisk(pindexRecur); - - list listPubCoinInLoop = list(); - CWalletDB walletdbInLoop(pwalletMain->strWalletFile); - walletdbInLoop.ListPubCoin(listPubCoinInLoop); - - BOOST_FOREACH(const CTransaction& tx, blockRecur.vtx){ - // Check Mint Zerocoin Transaction - BOOST_FOREACH(const CTxOut txout, tx.vout) { - if (!txout.scriptPubKey.empty() && txout.scriptPubKey.IsZerocoinMint()) { - vector vchZeroMint; - vchZeroMint.insert(vchZeroMint.end(), txout.scriptPubKey.begin() + 6, txout.scriptPubKey.begin() + txout.scriptPubKey.size()); - - CBigNum pubCoin; - pubCoin.setvch(vchZeroMint); - //printf("FOUND MINT ZEROCOIN AT HEIGHT = %d\n", pindexRecur->nHeight); - - BOOST_FOREACH(const CZerocoinEntry& pubCoinItem, listPubCoinInLoop) { - if (pubCoinItem.value == pubCoin) { - - CZerocoinEntry pubCoinTx; - - // PUBCOIN IS IN DB, BUT NOT UPDATE ID - //printf("UPDATING\n"); - // GET MAX ID - int currentId = 1; - BOOST_FOREACH(const CZerocoinEntry& maxIdPubcoin, listPubCoinInLoop) { - if (maxIdPubcoin.id > currentId && maxIdPubcoin.denomination == pubCoinItem.denomination) { - currentId = maxIdPubcoin.id; + //walletdb.ReadCalculatedZCBlock(lastCalculatedZCBlock); + //printf("- lastCalculatedZCBlock: %d\n", lastCalculatedZCBlock); + //printf("PROCESS BLOCK = %d\n", pindexRecur->nHeight); + if(pindexRecur->nHeight < lastCalculatedZCBlock){ + pindexRecur = pindexRecur->pnext; + continue; + }else{ + CBlock blockRecur; + blockRecur.ReadFromDisk(pindexRecur); + + list listPubCoinInLoop = list(); + CWalletDB walletdbInLoop(pwalletMain->strWalletFile); + walletdbInLoop.ListPubCoin(listPubCoinInLoop); + + BOOST_FOREACH(const CTransaction& tx, blockRecur.vtx){ + // Check Mint Zerocoin Transaction + BOOST_FOREACH(const CTxOut txout, tx.vout) { + if (!txout.scriptPubKey.empty() && txout.scriptPubKey.IsZerocoinMint()) { + vector vchZeroMint; + vchZeroMint.insert(vchZeroMint.end(), txout.scriptPubKey.begin() + 6, txout.scriptPubKey.begin() + txout.scriptPubKey.size()); + + CBigNum pubCoin; + pubCoin.setvch(vchZeroMint); + printf("FOUND MINT ZEROCOIN AT HEIGHT = %d\n", pindexRecur->nHeight); + + BOOST_FOREACH(const CZerocoinEntry& pubCoinItem, listPubCoinInLoop) { + if (pubCoinItem.value == pubCoin) { + + CZerocoinEntry pubCoinTx; + + // PUBCOIN IS IN DB, BUT NOT UPDATE ID + //printf("UPDATING\n"); + // GET MAX ID + int currentId = 1; + BOOST_FOREACH(const CZerocoinEntry& maxIdPubcoin, listPubCoinInLoop) { + if (maxIdPubcoin.id > currentId && maxIdPubcoin.denomination == pubCoinItem.denomination) { + currentId = maxIdPubcoin.id; + } } - } - // FIND HOW MANY OF MAX ID - unsigned int countExistingItems = 0; - BOOST_FOREACH(const CZerocoinEntry& countItemPubcoin, listPubCoinInLoop) { - if (currentId == countItemPubcoin.id && countItemPubcoin.denomination == pubCoinItem.denomination) { - countExistingItems++; - //printf("pubCoinItem.id = %d denomination = %d\n", countItemPubcoin.id, countItemPubcoin.denomination); + // FIND HOW MANY OF MAX ID + unsigned int countExistingItems = 0; + BOOST_FOREACH(const CZerocoinEntry& countItemPubcoin, listPubCoinInLoop) { + if (currentId == countItemPubcoin.id && countItemPubcoin.denomination == pubCoinItem.denomination) { + countExistingItems++; + //printf("pubCoinItem.id = %d denomination = %d\n", countItemPubcoin.id, countItemPubcoin.denomination); + } } - } - // IF IT IS NOT 10 -> ADD MORE - if (countExistingItems < 10) { - pubCoinTx.id = currentId; - } - else {// ELSE INCREASE 1 -> ADD - currentId += 1; - pubCoinTx.id = currentId; - } + // IF IT IS NOT 10 -> ADD MORE + if (countExistingItems < 10) { + pubCoinTx.id = currentId; + } + else {// ELSE INCREASE 1 -> ADD + currentId += 1; + pubCoinTx.id = currentId; + } - pubCoinTx.IsUsed = pubCoinItem.IsUsed; - pubCoinTx.randomness = pubCoinItem.randomness; - pubCoinTx.denomination = pubCoinItem.denomination; - pubCoinTx.serialNumber = pubCoinItem.serialNumber; - pubCoinTx.value = pubCoinItem.value; - pubCoinTx.nHeight = pindexRecur->nHeight; - //printf("REORG PUBCOIN ID: %d HEIGHT: %d DENOMINATION: %d\n", pubCoinTx.id, pubCoinTx.nHeight,pubCoinItem.denomination); - walletdbInLoop.WriteZerocoinEntry(pubCoinTx); + pubCoinTx.IsUsed = pubCoinItem.IsUsed; + pubCoinTx.randomness = pubCoinItem.randomness; + pubCoinTx.denomination = pubCoinItem.denomination; + pubCoinTx.serialNumber = pubCoinItem.serialNumber; + pubCoinTx.value = pubCoinItem.value; + pubCoinTx.nHeight = pindexRecur->nHeight; + //printf("REORG PUBCOIN ID: %d HEIGHT: %d DENOMINATION: %d\n", pubCoinTx.id, pubCoinTx.nHeight,pubCoinItem.denomination); + walletdbInLoop.WriteZerocoinEntry(pubCoinTx); + } } - } + } } - } } - //printf("PROCESS BLOCK = %d\n", pindexRecur->nHeight); - pindexRecur = pindexRecur->pnext; + //printf("PROCESS BLOCK = %d\n", pindexRecur->nHeight); + walletdb.WriteCalculatedZCBlock(pindexRecur->nHeight); + pindexRecur = pindexRecur->pnext; + } } } @@ -1187,7 +1206,7 @@ bool AppInit2(boost::thread_group& threadGroup) } printf("%s", strErrors.str().c_str()); - printf(" wallet %15"PRI64d"ms\n", GetTimeMillis() - nStart); + printf(" wallet %15" PRI64d"ms\n", GetTimeMillis() - nStart); RegisterWallet(pwalletMain); @@ -1210,7 +1229,7 @@ bool AppInit2(boost::thread_group& threadGroup) printf("Rescanning last %i blocks (from block %i)...\n", pindexBest->nHeight - pindexRescan->nHeight, pindexRescan->nHeight); nStart = GetTimeMillis(); pwalletMain->ScanForWalletTransactions(pindexRescan, true); - printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart); + printf(" rescan %15" PRI64d"ms\n", GetTimeMillis() - nStart); pwalletMain->SetBestChain(CBlockLocator(pindexBest)); nWalletDBUpdated++; } @@ -1243,7 +1262,7 @@ bool AppInit2(boost::thread_group& threadGroup) printf("Invalid or missing peers.dat; recreating\n"); } - printf("Loaded %i addresses from peers.dat %"PRI64d"ms\n", + printf("Loaded %i addresses from peers.dat %" PRI64d"ms\n", addrman.size(), GetTimeMillis() - nStart); // ********************************************************* Step 11: start node @@ -1257,11 +1276,11 @@ bool AppInit2(boost::thread_group& threadGroup) RandAddSeedPerfmon(); //// debug print - printf("mapBlockIndex.size() = %"PRIszu"\n", mapBlockIndex.size()); + printf("mapBlockIndex.size() = %" PRIszu"\n", mapBlockIndex.size()); printf("nBestHeight = %d\n", nBestHeight); - printf("setKeyPool.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0); - printf("mapWallet.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapWallet.size() : 0); - printf("mapAddressBook.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0); + printf("setKeyPool.size() = %" PRIszu"\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0); + printf("mapWallet.size() = %" PRIszu"\n", pwalletMain ? pwalletMain->mapWallet.size() : 0); + printf("mapAddressBook.size() = %" PRIszu"\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0); StartNode(threadGroup); diff --git a/src/main.cpp b/src/main.cpp index 80a272ac7c..8a3d50f081 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -324,7 +324,7 @@ bool AddOrphanTx(const CTransaction& tx) BOOST_FOREACH(const CTxIn& txin, tx.vin) mapOrphanTransactionsByPrev[txin.prevout.hash].insert(hash); - printf("stored orphan tx %s (mapsz %"PRIszu")\n", hash.ToString().c_str(), + printf("stored orphan tx %s (mapsz %" PRIszu")\n", hash.ToString().c_str(), mapOrphanTransactions.size()); return true; } @@ -1781,7 +1781,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fCheckIn // Don't accept it if it can't get into a block int64 txMinFee = tx.GetMinFee(1000, true, GMF_RELAY); if (fLimitFree && nFees < txMinFee) - return error("CTxMemPool::accept() : not enough fees %s, %"PRI64d" < %"PRI64d, + return error("CTxMemPool::accept() : not enough fees %s, %" PRI64d" < %" PRI64d, hash.ToString().c_str(), nFees, txMinFee); @@ -1809,7 +1809,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fCheckIn } if (fRejectInsaneFee && nFees > CTransaction::nMinRelayTxFee * 1000) - return error("CTxMemPool::accept() : insane fees %s, %"PRI64d" > %"PRI64d, + return error("CTxMemPool::accept() : insane fees %s, %" PRI64d" > %" PRI64d, hash.ToString().c_str(), nFees, CTransaction::nMinRelayTxFee * 1000); @@ -2868,7 +2868,7 @@ bool CBlock::ConnectBlock(CValidationState &state, CBlockIndex* pindex, CCoinsVi printf("- Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin)\n", (unsigned)vtx.size(), 0.001 * nTime, 0.001 * nTime / vtx.size(), nInputs <= 1 ? 0 : 0.001 * nTime / (nInputs-1)); if (vtx[0].GetValueOut() > GetBlockValue(pindex->nHeight, nFees, pindex->nTime)) - return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%"PRI64d" vs limit=%"PRI64d")", vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees, pindex->nTime))); + return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%" PRI64d" vs limit=%" PRI64d")", vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees, pindex->nTime))); if (!control.Wait()) return state.DoS(100, false); @@ -2951,8 +2951,8 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew) //reverse(vConnectZC.begin(), vConnectZC.end()); if (vDisconnect.size() > 0) { - printf("REORGANIZE: Disconnect %"PRIszu" blocks; %s..\n", vDisconnect.size(), pfork->GetBlockHash().ToString().c_str()); - printf("REORGANIZE: Connect %"PRIszu" blocks; ..%s\n", vConnect.size(), pindexNew->GetBlockHash().ToString().c_str()); + printf("REORGANIZE: Disconnect %" PRIszu" blocks; %s..\n", vDisconnect.size(), pfork->GetBlockHash().ToString().c_str()); + printf("REORGANIZE: Connect %" PRIszu" blocks; ..%s\n", vConnect.size(), pindexNew->GetBlockHash().ToString().c_str()); } // Disconnect shorter branch @@ -3236,13 +3236,12 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew) walletdb.WriteZerocoinEntry(pubCoinTx); } } - - - - } } + } + + walletdb.WriteCalculatedZCBlock(pindex->nHeight); } // Flush changes to global coin state @@ -4381,7 +4380,7 @@ void PrintBlockTree() // print item CBlock block; block.ReadFromDisk(pindex); - printf("%d (blk%05u.dat:0x%x) %s tx %"PRIszu"", + printf("%d (blk%05u.dat:0x%x) %s tx %" PRIszu"", pindex->nHeight, pindex->GetBlockPos().nFile, pindex->GetBlockPos().nPos, DateTimeStrFormat("%Y-%m-%d %H:%M:%S", block.GetBlockTime()).c_str(), @@ -4474,7 +4473,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) AbortNode(_("Error: system error: ") + e.what()); } if (nLoaded > 0) - printf("Loaded %i blocks from external file in %"PRI64d"ms\n", nLoaded, GetTimeMillis() - nStart); + printf("Loaded %i blocks from external file in %" PRI64d"ms\n", nLoaded, GetTimeMillis() - nStart); return nLoaded > 0; } @@ -4726,7 +4725,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) { RandAddSeedPerfmon(); if (fDebug) - printf("received: %s (%"PRIszu" bytes)\n", strCommand.c_str(), vRecv.size()); + printf("received: %s (%" PRIszu" bytes)\n", strCommand.c_str(), vRecv.size()); if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0) { printf("dropmessagestest DROPPING RECV MESSAGE\n"); @@ -4865,7 +4864,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (vAddr.size() > 1000) { pfrom->Misbehaving(20); - return error("message addr size() = %"PRIszu"", vAddr.size()); + return error("message addr size() = %" PRIszu"", vAddr.size()); } // Store the new addresses @@ -4928,7 +4927,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (vInv.size() > MAX_INV_SZ) { pfrom->Misbehaving(20); - return error("message inv size() = %"PRIszu"", vInv.size()); + return error("message inv size() = %" PRIszu"", vInv.size()); } // find last block in inv vector @@ -4977,11 +4976,11 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (vInv.size() > MAX_INV_SZ) { pfrom->Misbehaving(20); - return error("message getdata size() = %"PRIszu"", vInv.size()); + return error("message getdata size() = %" PRIszu"", vInv.size()); } if (fDebugNet || (vInv.size() != 1)) - printf("received getdata (%"PRIszu" invsz)\n", vInv.size()); + printf("received getdata (%" PRIszu" invsz)\n", vInv.size()); if ((fDebugNet && vInv.size() > 0) || (vInv.size() == 1)) printf("received getdata for: %s\n", vInv[0].ToString().c_str()); @@ -5084,7 +5083,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) vWorkQueue.push_back(inv.hash); vEraseQueue.push_back(inv.hash); - printf("AcceptToMemoryPool: %s %s : accepted %s (poolsz %"PRIszu")\n", + printf("AcceptToMemoryPool: %s %s : accepted %s (poolsz %" PRIszu")\n", pfrom->addr.ToString().c_str(), pfrom->cleanSubVer.c_str(), tx.GetHash().ToString().c_str(), mempool.mapTx.size()); @@ -5133,7 +5132,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) //vWorkQueue.push_back(inv.hash); //vEraseQueue.push_back(inv.hash); - printf("AcceptToMemoryPool: %s %s : accepted %s (poolsz %"PRIszu")\n", + printf("AcceptToMemoryPool: %s %s : accepted %s (poolsz %" PRIszu")\n", pfrom->addr.ToString().c_str(), pfrom->cleanSubVer.c_str(), tx.GetHash().ToString().c_str(), mempool.mapTx.size()); @@ -6078,7 +6077,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) nLastBlockTx = nBlockTx; nLastBlockSize = nBlockSize; - printf("CreateNewBlock(): total size %"PRI64u"\n", nBlockSize); + printf("CreateNewBlock(): total size %" PRI64u"\n", nBlockSize); @@ -6317,7 +6316,7 @@ void static ScryptMiner(CWallet *pwallet) CBlock *pblock = &pblocktemplate->block; IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); - printf("Running ScryptMiner with %"PRIszu" transactions in block (%u bytes)\n", pblock->vtx.size(), + printf("Running ScryptMiner with %" PRIszu" transactions in block (%u bytes)\n", pblock->vtx.size(), ::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION)); // diff --git a/src/main.h b/src/main.h index 56bb0eea0e..be90a98e95 100755 --- a/src/main.h +++ b/src/main.h @@ -446,7 +446,7 @@ class CTxOut std::string ToString() const { - return strprintf("CTxOut(nValue=%"PRI64d".%08"PRI64d", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30).c_str()); + return strprintf("CTxOut(nValue=%" PRI64d".%08" PRI64d", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30).c_str()); } void print() const @@ -661,7 +661,7 @@ void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCach std::string ToString() const { std::string str; - str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%"PRIszu", vout.size=%"PRIszu", nLockTime=%u)\n", + str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%" PRIszu", vout.size=%" PRIszu", nLockTime=%u)\n", GetHash().ToString().c_str(), nVersion, vin.size(), @@ -1557,7 +1557,7 @@ class CBlock : public CBlockHeader void print() const { - printf("CBlock(hash=%s, input=%s, PoW=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%"PRIszu")\n", + printf("CBlock(hash=%s, input=%s, PoW=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%" PRIszu")\n", GetHash().ToString().c_str(), HexStr(BEGIN(nVersion),BEGIN(nVersion)+80,false).c_str(), GetPoWHash(LastHeight + 1).ToString().c_str(), diff --git a/src/makefile.osx b/src/makefile.osx index 5069a65582..c2c1075a59 100755 --- a/src/makefile.osx +++ b/src/makefile.osx @@ -8,16 +8,20 @@ CXX=llvm-g++ DEPSDIR=/usr/local +DB4DIR=/usr/local/opt/berkeley-db4 +OPENSSLDIR=/usr/local/opt/openssl INCLUDEPATHS= \ -I"$(CURDIR)" \ - -I"$(CURDIR)"/obj \ + -I"$(CURDIR)/obj" \ -I"$(DEPSDIR)/include" \ - -I"$(DEPSDIR)/opt/berkeley-db4/include" + -I"$(DB4DIR)/include" \ + -I"$(OPENSSLDIR)/include" LIBPATHS= \ -L"$(DEPSDIR)/lib" \ - -L"$(DEPSDIR)/opt/berkeley-db4/lib" + -L"$(DB4DIR)/lib" \ + -L"$(OPENSSLDIR)/lib" USE_UPNP:=1 USE_IPV6:=1 @@ -31,14 +35,14 @@ ifdef STATIC TESTLIBS += \ $(DEPSDIR)/lib/libboost_unit_test_framework-mt.a LIBS += \ - $(DEPSDIR)/lib/db48/libdb_cxx-4.8.a \ + $(DB4DIR)/lib/libdb_cxx-4.8.a \ $(DEPSDIR)/lib/libboost_system-mt.a \ $(DEPSDIR)/lib/libboost_filesystem-mt.a \ $(DEPSDIR)/lib/libboost_program_options-mt.a \ $(DEPSDIR)/lib/libboost_thread-mt.a \ $(DEPSDIR)/lib/libboost_chrono-mt.a \ - $(DEPSDIR)/lib/libssl.a \ - $(DEPSDIR)/lib/libcrypto.a \ + $(OPENSSLDIR)/lib/libssl.a \ + $(OPENSSLDIR)/lib/libcrypto.a \ -lz else TESTLIBS += \ @@ -62,7 +66,7 @@ ifdef RELEASE # Compile for maximum compatibility and smallest size. # This requires that dependencies are compiled # the same way. -CFLAGS = -mmacosx-version-min=10.5 -arch i386 -O3 +CFLAGS = -mmacosx-version-min=10.7 -arch x86_64 -O3 else DEBUGFLAGS = -g endif diff --git a/src/net.cpp b/src/net.cpp index 7384bc2047..3ce41ecb9d 100755 --- a/src/net.cpp +++ b/src/net.cpp @@ -1262,7 +1262,7 @@ void DumpAddresses() CAddrDB adb; adb.Write(addrman); - printf("Flushed %d addresses to peers.dat %"PRI64d"ms\n", + printf("Flushed %d addresses to peers.dat %" PRI64d"ms\n", addrman.size(), GetTimeMillis() - nStart); } diff --git a/src/net.h b/src/net.h index 0f4ba4f415..83e8b09b70 100755 --- a/src/net.h +++ b/src/net.h @@ -366,7 +366,7 @@ class CNode else nRequestTime = 0; if (fDebugNet) - printf("askfor %s %"PRI64d" (%s)\n", inv.ToString().c_str(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000).c_str()); + printf("askfor %s %" PRI64d" (%s)\n", inv.ToString().c_str(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000).c_str()); // Make sure not to reuse time indexes to keep things in the same order int64 nNow = (GetTime() - 1) * 1000000; diff --git a/src/obj/build.h b/src/obj/build.h deleted file mode 100644 index 9311246995..0000000000 --- a/src/obj/build.h +++ /dev/null @@ -1,2 +0,0 @@ -// No build information available -#define BUILD_DATE "2016-10-05 19:24:32 -0700" diff --git a/src/qt/res/bitcoin-qt.rc b/src/qt/res/bitcoin-qt.rc index f4d7d30f40..959346d33d 100755 --- a/src/qt/res/bitcoin-qt.rc +++ b/src/qt/res/bitcoin-qt.rc @@ -20,14 +20,14 @@ BEGIN BEGIN BLOCK "040904E4" // U.S. English - multilingual (hex) BEGIN - VALUE "CompanyName", "zcoin" - VALUE "FileDescription", "zcoin-Qt (OSS GUI client for zcoin)" + VALUE "CompanyName", "Zcoin" + VALUE "FileDescription", "Zcoin (OSS GUI client for Zcoin)" VALUE "FileVersion", VER_FILEVERSION_STR - VALUE "InternalName", "zcoin-qt" + VALUE "InternalName", "Zcoin" VALUE "LegalCopyright", COPYRIGHT_STR 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", "zcoin-qt.exe" - VALUE "ProductName", "zcoin-Qt" + VALUE "OriginalFilename", "Zcoin.exe" + VALUE "ProductName", "Zcoin" VALUE "ProductVersion", VER_PRODUCTVERSION_STR END END diff --git a/src/qt/res/icons/16x16.png b/src/qt/res/icons/16x16.png old mode 100755 new mode 100644 index 526e905010..97aec16517 Binary files a/src/qt/res/icons/16x16.png and b/src/qt/res/icons/16x16.png differ diff --git a/src/qt/res/icons/toolbar.png b/src/qt/res/icons/toolbar.png old mode 100755 new mode 100644 index 526e905010..97aec16517 Binary files a/src/qt/res/icons/toolbar.png and b/src/qt/res/icons/toolbar.png differ diff --git a/src/qt/res/icons/zcoin.icns b/src/qt/res/icons/zcoin.icns old mode 100755 new mode 100644 index aef6a2ed97..f7058828ed Binary files a/src/qt/res/icons/zcoin.icns and b/src/qt/res/icons/zcoin.icns differ diff --git a/src/qt/res/icons/zcoin.ico b/src/qt/res/icons/zcoin.ico old mode 100755 new mode 100644 index 7591d88d46..125f427cb3 Binary files a/src/qt/res/icons/zcoin.ico and b/src/qt/res/icons/zcoin.ico differ diff --git a/src/qt/res/icons/zcoin.png b/src/qt/res/icons/zcoin.png old mode 100755 new mode 100644 index eee9b1036d..09812665a7 Binary files a/src/qt/res/icons/zcoin.png and b/src/qt/res/icons/zcoin.png differ diff --git a/src/qt/res/icons/zerocoin.png b/src/qt/res/icons/zerocoin.png old mode 100755 new mode 100644 index eee9b1036d..be3c9cfd9b Binary files a/src/qt/res/icons/zerocoin.png and b/src/qt/res/icons/zerocoin.png differ diff --git a/src/qt/res/images/splash.png b/src/qt/res/images/splash.png old mode 100755 new mode 100644 index 9fc1e4c5a6..4792ec94ed Binary files a/src/qt/res/images/splash.png and b/src/qt/res/images/splash.png differ diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 3a42e719ea..26a3daf107 100755 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -25,10 +25,10 @@ SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) : // define text to place QString titleText = QString(QApplication::applicationName()).replace(QString("-testnet"), QString(""), Qt::CaseSensitive); // cut of testnet, place it as single object further down - QString versionText = QString("Version %1 ").arg(QString::fromStdString(FormatFullVersion())); - QString copyrightText1 = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin developers")); - QString copyrightText2 = QChar(0xA9)+QString(" 2011-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Litecoin developers")); - QString copyrightText3 = QChar(0xA9)+QString(" 2014 ") + QString(tr("The ZCoin developers")); + //QString versionText = QString("Version %1 ").arg(QString::fromStdString(FormatFullVersion())); + //QString copyrightText1 = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin developers")); + //QString copyrightText2 = QChar(0xA9)+QString(" 2011-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Litecoin developers")); + //QString copyrightText3 = QChar(0xA9)+QString(" 2014 ") + QString(tr("The ZCoin developers")); QString font = "Arial"; @@ -45,13 +45,13 @@ SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) : pixPaint.setPen(QColor(70,70,70)); pixPaint.setFont(QFont(font, 9*fontFactor)); - pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line4,versionText); + //pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line4,versionText); // draw copyright stuff pixPaint.setFont(QFont(font, 9*fontFactor)); - pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line1,copyrightText1); - pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line2,copyrightText2); - pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line3,copyrightText3); + //pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line1,copyrightText1); + //pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line2,copyrightText2); + //pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line3,copyrightText3); pixPaint.end(); diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index d22cebd9bf..5c58c13f01 100755 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -48,7 +48,7 @@ Value getpeerinfo(const Array& params, bool fHelp) Object obj; obj.push_back(Pair("addr", stats.addrName)); - obj.push_back(Pair("services", strprintf("%08"PRI64x, stats.nServices))); + obj.push_back(Pair("services", strprintf("%08" PRI64x, stats.nServices))); obj.push_back(Pair("lastsend", (boost::int64_t)stats.nLastSend)); obj.push_back(Pair("lastrecv", (boost::int64_t)stats.nLastRecv)); obj.push_back(Pair("bytessent", (boost::int64_t)stats.nSendBytes)); diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index e7084572fd..dbbe61330e 100755 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -746,7 +746,7 @@ static CScript _createmultisig(const Array& params) if ((int)keys.size() < nRequired) throw runtime_error( strprintf("not enough keys supplied " - "(got %"PRIszu" keys, but need at least %d to redeem)", keys.size(), nRequired)); + "(got %" PRIszu" keys, but need at least %d to redeem)", keys.size(), nRequired)); std::vector pubkeys; pubkeys.resize(keys.size()); for (unsigned int i = 0; i < keys.size(); i++) diff --git a/src/util.cpp b/src/util.cpp index 058aa6e17a..44102deae6 100755 --- a/src/util.cpp +++ b/src/util.cpp @@ -392,7 +392,7 @@ string FormatMoney(int64 n, bool fPlus) int64 n_abs = (n > 0 ? n : -n); int64 quotient = n_abs/COIN; int64 remainder = n_abs%COIN; - string str = strprintf("%"PRI64d".%08"PRI64d, quotient, remainder); + string str = strprintf("%" PRI64d".%08" PRI64d, quotient, remainder); // Right-trim excess zeros before the decimal point: int nTrim = 0; @@ -1329,7 +1329,7 @@ void AddTimeData(const CNetAddr& ip, int64 nTime) // Add data vTimeOffsets.input(nOffsetSample); - printf("Added time data, samples %d, offset %+"PRI64d" (%+"PRI64d" minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60); + printf("Added time data, samples %d, offset %+" PRI64d" (%+" PRI64d" minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60); if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1) { int64 nMedian = vTimeOffsets.median(); @@ -1364,10 +1364,10 @@ void AddTimeData(const CNetAddr& ip, int64 nTime) } if (fDebug) { BOOST_FOREACH(int64 n, vSorted) - printf("%+"PRI64d" ", n); + printf("%+" PRI64d" ", n); printf("| "); } - printf("nTimeOffset = %+"PRI64d" (%+"PRI64d" minutes)\n", nTimeOffset, nTimeOffset/60); + printf("nTimeOffset = %+" PRI64d" (%+" PRI64d" minutes)\n", nTimeOffset, nTimeOffset/60); } } diff --git a/src/util.h b/src/util.h index 73420d3e77..7b1e391a07 100755 --- a/src/util.h +++ b/src/util.h @@ -239,7 +239,7 @@ void runCommand(std::string strCommand); inline std::string i64tostr(int64 n) { - return strprintf("%"PRI64d, n); + return strprintf("%" PRI64d, n); } inline std::string itostr(int n) diff --git a/src/version.cpp b/src/version.cpp index d9d6724a02..dba808a1a7 100755 --- a/src/version.cpp +++ b/src/version.cpp @@ -11,7 +11,7 @@ const std::string CLIENT_NAME("Satoshi"); // Client version number -#define CLIENT_VERSION_SUFFIX "-beta" +#define CLIENT_VERSION_SUFFIX "" // The following part of the code determines the CLIENT_BUILD variable. diff --git a/src/version.h b/src/version.h index 86a201d92e..0c2908c4a8 100755 --- a/src/version.h +++ b/src/version.h @@ -25,7 +25,7 @@ extern const std::string CLIENT_DATE; // network protocol versioning // -static const int PROTOCOL_VERSION = 90017; +static const int PROTOCOL_VERSION = 90018; // intial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 90013; diff --git a/src/wallet.cpp b/src/wallet.cpp index 32d6288f65..28d465d039 100755 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -2291,7 +2291,7 @@ void CWallet::PrintWallet(const CBlock& block) if (mapWallet.count(block.vtx[0].GetHash())) { CWalletTx& wtx = mapWallet[block.vtx[0].GetHash()]; - printf(" mine: %d %d %"PRI64d"", wtx.GetDepthInMainChain(), wtx.GetBlocksToMaturity(), wtx.GetCredit()); + printf(" mine: %d %d %" PRI64d"", wtx.GetDepthInMainChain(), wtx.GetBlocksToMaturity(), wtx.GetCredit()); } } printf("\n"); @@ -2355,7 +2355,7 @@ bool CWallet::NewKeyPool() walletdb.WritePool(nIndex, CKeyPool(GenerateNewKey())); setKeyPool.insert(nIndex); } - printf("CWallet::NewKeyPool wrote %"PRI64d" new keys\n", nKeys); + printf("CWallet::NewKeyPool wrote %" PRI64d" new keys\n", nKeys); } return true; } @@ -2380,7 +2380,7 @@ bool CWallet::TopUpKeyPool() if (!walletdb.WritePool(nEnd, CKeyPool(GenerateNewKey()))) throw runtime_error("TopUpKeyPool() : writing generated key failed"); setKeyPool.insert(nEnd); - printf("keypool added key %"PRI64d", size=%"PRIszu"\n", nEnd, setKeyPool.size()); + printf("keypool added key %" PRI64d", size=%" PRIszu"\n", nEnd, setKeyPool.size()); } } return true; @@ -2409,7 +2409,7 @@ void CWallet::ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool) if (!HaveKey(keypool.vchPubKey.GetID())) throw runtime_error("ReserveKeyFromKeyPool() : unknown key in key pool"); assert(keypool.vchPubKey.IsValid()); - printf("keypool reserve %"PRI64d"\n", nIndex); + printf("keypool reserve %" PRI64d"\n", nIndex); } } @@ -2436,7 +2436,7 @@ void CWallet::KeepKey(int64 nIndex) CWalletDB walletdb(strWalletFile); walletdb.ErasePool(nIndex); } - printf("keypool keep %"PRI64d"\n", nIndex); + printf("keypool keep %" PRI64d"\n", nIndex); } void CWallet::ReturnKey(int64 nIndex) @@ -2446,7 +2446,7 @@ void CWallet::ReturnKey(int64 nIndex) LOCK(cs_wallet); setKeyPool.insert(nIndex); } - printf("keypool return %"PRI64d"\n", nIndex); + printf("keypool return %" PRI64d"\n", nIndex); } bool CWallet::GetKeyFromPool(CPubKey& result, bool fAllowReuse) diff --git a/src/walletdb.cpp b/src/walletdb.cpp index fb2b0c404d..2416eade14 100755 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -83,6 +83,17 @@ bool CWalletDB::EarseZerocoinEntry(const CZerocoinEntry& zerocoin) return Erase(make_pair(string("zerocoin"), zerocoin.value)); } +// Check Calculated Blocked for Zerocoin +bool CWalletDB::ReadCalculatedZCBlock(int& hight) +{ + hight = 0; + return Read(std::string("calculatedzcblock"), hight); +} + +bool CWalletDB::WriteCalculatedZCBlock(int hight) +{ + return Write(std::string("calculatedzcblock"), hight); +} void CWalletDB::ListPubCoin(std::list& listPubCoin) @@ -353,7 +364,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, pwallet->mapWallet[hash] = wtx; //// debug print //printf("LoadWallet %s\n", wtx.GetHash().ToString().c_str()); - //printf(" %12"PRI64d" %s %s %s\n", + //printf(" %12" PRI64d" %s %s %s\n", // wtx.vout[0].nValue, // DateTimeStrFormat("%Y-%m-%d %H:%M:%S", wtx.GetBlockTime()).c_str(), // wtx.hashBlock.ToString().c_str(), @@ -635,7 +646,7 @@ void ThreadFlushWalletDB(const string& strFile) bitdb.CheckpointLSN(strFile); bitdb.mapFileUseCount.erase(mi++); - printf("Flushed wallet.dat %"PRI64d"ms\n", GetTimeMillis() - nStart); + printf("Flushed wallet.dat %" PRI64d"ms\n", GetTimeMillis() - nStart); } } } @@ -696,7 +707,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys) // Set -rescan so any missing transactions will be // found. int64 now = GetTime(); - std::string newFilename = strprintf("wallet.%"PRI64d".bak", now); + std::string newFilename = strprintf("wallet.%" PRI64d".bak", now); int result = dbenv.dbenv.dbrename(NULL, filename.c_str(), NULL, newFilename.c_str(), DB_AUTO_COMMIT); @@ -715,7 +726,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys) printf("Salvage(aggressive) found no records in %s.\n", newFilename.c_str()); return false; } - printf("Salvage(aggressive) found %"PRIszu" records\n", salvagedData.size()); + printf("Salvage(aggressive) found %" PRIszu" records\n", salvagedData.size()); bool fSuccess = allOK; Db* pdbCopy = new Db(&dbenv.dbenv, 0); diff --git a/src/walletdb.h b/src/walletdb.h index eccfcfa8c9..f2036ad38a 100755 --- a/src/walletdb.h +++ b/src/walletdb.h @@ -165,6 +165,9 @@ class CWalletDB : public CDB bool WriteZerocoinAccumulator(libzerocoin::Accumulator accumulator, libzerocoin::CoinDenomination denomination); bool ReadZerocoinAccumulator(libzerocoin::Accumulator& accumulator, libzerocoin::CoinDenomination denomination); + bool ReadCalculatedZCBlock(int& hight); + bool WriteCalculatedZCBlock(int hight); + DBErrors ReorderTransactions(CWallet*); DBErrors LoadWallet(CWallet* pwallet); static bool Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys); diff --git a/zcoin.pro b/zcoin.pro index de217ed42e..d10fa56d4e 100755 --- a/zcoin.pro +++ b/zcoin.pro @@ -25,10 +25,10 @@ UI_DIR = build # use: qmake "RELEASE=1" contains(RELEASE, 1) { - # Mac: compile for maximum compatibility (10.5, 32-bit) - macx:QMAKE_CXXFLAGS += -mmacosx-version-min=10.5 -arch x86_64 - macx:QMAKE_CFLAGS += -mmacosx-version-min=10.5 -arch x86_64 - macx:QMAKE_OBJECTIVE_CFLAGS += -mmacosx-version-min=10.5 -arch x86_64 + # Mac: compile for maximum compatibility (10.7, 64-bit) + macx:QMAKE_CXXFLAGS += -mmacosx-version-min=10.7 -arch x86_64 + macx:QMAKE_CFLAGS += -mmacosx-version-min=10.7 -arch x86_64 + macx:QMAKE_OBJECTIVE_CFLAGS += -mmacosx-version-min=10.7 -arch x86_64 !win32:!macx { # Linux: static link and extra security (see: https://wiki.debian.org/Hardening) @@ -414,11 +414,19 @@ isEmpty(BDB_INCLUDE_PATH) { } isEmpty(BOOST_LIB_PATH) { - macx:BOOST_LIB_PATH = /opt/local/lib + macx:BOOST_LIB_PATH = /usr/local/opt/boost/lib } isEmpty(BOOST_INCLUDE_PATH) { - macx:BOOST_INCLUDE_PATH = /opt/local/include + macx:BOOST_INCLUDE_PATH = /usr/local/opt/boost/include +} + +isEmpty(OPENSSL_LIB_PATH) { + macx:OPENSSL_LIB_PATH = /usr/local/opt/openssl/lib +} + +isEmpty(OPENSSL_INCLUDE_PATH) { + macx:OPENSSL_INCLUDE_PATH = /usr/local/opt/openssl/include } win32:DEFINES += WIN32 @@ -465,7 +473,7 @@ macx:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX contains(RELEASE, 1) { !win32:!macx { # Linux: turn dynamic linking back on for c/c++ runtime libraries - LIBS += -Wl,-Bdynamic + LIBS += -Wl,-Bdynamic -ldl } } diff --git a/zcoin.pro.user b/zcoin.pro.user deleted file mode 100644 index 189e685581..0000000000 --- a/zcoin.pro.user +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - EnvironmentId - {e7f32cd1-a88a-4cc0-952c-8f8d0e7e435d} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - Desktop - Desktop - {a97dfab0-0ccc-4108-a5ba-8ca516f52f66} - 0 - 0 - 0 - - - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 1 - - - 0 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy locally - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - zcoin - - Qt4ProjectManager.Qt4RunConfiguration:/home/bushido/Desktop/zcoin/zcoin.pro - - zcoin.pro - false - false - - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 18 - - - Version - 18 - -