From 5a9818eec73fe09a6d95b918f99d44bae1025abd Mon Sep 17 00:00:00 2001 From: TFinch Date: Tue, 18 Dec 2018 20:06:53 -0500 Subject: [PATCH] Revert "v1.1.0.1 (#13)" (#14) This reverts commit 1d87da11c2e5023df2a0697c6aecfd9454d7a630. --- .gitignore | 2 +- configure.ac | 2 +- src/chainparams.cpp | 10 +- src/chainparams.h | 13 - src/clientversion.h | 2 +- src/main.cpp | 257 ++-- src/qt/forms/overviewpage.ui | 2247 ++++++++++++--------------------- src/qt/forms/privacydialog.ui | 812 ++++++------ src/qt/overviewpage.cpp | 279 ++-- src/qt/overviewpage.h | 6 +- src/qt/privacydialog.cpp | 6 +- src/qt/res/css/default.css | 490 +++++-- src/spork.cpp | 31 +- src/spork.h | 2 +- src/version.h | 4 +- src/wallet.cpp | 111 +- src/wallet.h | 42 +- 17 files changed, 1925 insertions(+), 2391 deletions(-) diff --git a/.gitignore b/.gitignore index cec551c..54268a8 100644 --- a/.gitignore +++ b/.gitignore @@ -173,4 +173,4 @@ config.status .vs/CCBC/v15/ipch/AutoPCH/17a9e86b3fc8b7b0/BITCOINGUI.ipch .vs/CCBC/v15/ipch/AutoPCH/177e9d87b59f1805/PRIVACYDIALOG.ipch .vs/CCBC/v15/ipch/AutoPCH/97cdf6ca85efe74/PROTOCOL.ipch -.vs/CCBC/v15/ipch/AutoPCH/f836824dc3c97f9a/CCBC-CLI.ipch \ No newline at end of file +.vs/CCBC/v15/ipch/AutoPCH/f836824dc3c97f9a/CCBC-CLI.ipch diff --git a/configure.ac b/configure.ac index e3803c7..62a394e 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 1) define(_CLIENT_VERSION_MINOR, 1) define(_CLIENT_VERSION_REVISION, 0) -define(_CLIENT_VERSION_BUILD, 1) +define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2018) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 24da89d..be67a99 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -59,7 +59,6 @@ boost::assign::map_list_of (0, uint256("0xa9f081734c579a25872ce366d5520482755d26ff3db73fbe7bdd4e973bc0e173")); - static const Checkpoints::CCheckpointData data = { &mapCheckpoints, 1534438799, // * UNIX timestamp of last checkpoint block @@ -159,9 +158,6 @@ class CMainParams : public CChainParams genesis.nNonce = 647688; - nEnforceNewSporkKey = 1546300800; //!> Sporks signed after (GMT): Tuesday, Jan 1, 2018 12:00:00 AM GMT must use the new spork key - nRejectOldSporkKey = 1548979200; //!> Fully reject old spork key after (GMT): Friday, Feb 1, 2018 12:00:00 AM - hashGenesisBlock = genesis.GetHash(); //printf("genesis.GetHash = %s\n", genesis.GetHash().ToString().c_str()); @@ -202,10 +198,8 @@ class CMainParams : public CChainParams fHeadersFirstSyncingActive = false; nPoolMaxTransactions = 3; - - strSporkKey = "0257aa5bdba5b2458ac8acb5eb80277cee5c69e21a55299b5d7ac506c49d958984"; - strSporkKeyOld = "030262a2a0679d01ab026d375c42b0a4122477123631b870e09665526c322c8899"; - + //strSporkKey = "030262a2a0679d01ab026d375c42b0a4122477123631b870e09665526c322c8899"; + strSporkKey = "0257aa5bdba5b2458ac8acb5eb80277cee5c69e21a55299b5d7ac506c49d958984"; strObfuscationPoolDummyAddress = "XCNAsFGy8k7amqRG26ikKyfVDwK8585Z6b"; nStartMasternodePayments = 1534438799; diff --git a/src/chainparams.h b/src/chainparams.h index e5fc5d3..261cce0 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -91,17 +91,10 @@ class CChainParams const std::vector& FixedSeeds() const { return vFixedSeeds; } virtual const Checkpoints::CCheckpointData& Checkpoints() const = 0; int PoolMaxTransactions() const { return nPoolMaxTransactions; } - - //Spork Related items - //std::string SporkKey() const { return strSporkKey; } std::string SporkKey() const { return strSporkKey; } - std::string SporkKeyOld() const { return strSporkKeyOld; } - int64_t NewSporkStart() const { return nEnforceNewSporkKey; } - int64_t RejectOldSporkKey() const { return nRejectOldSporkKey; } std::string ObfuscationPoolDummyAddress() const { return strObfuscationPoolDummyAddress; } int64_t StartMasternodePayments() const { return nStartMasternodePayments; } int64_t Budget_Fee_Confirmations() const { return nBudget_Fee_Confirmations; } - CBaseChainParams::Network NetworkID() const { return networkID; } /** Zerocoin **/ @@ -173,13 +166,7 @@ class CChainParams bool fTestnetToBeDeprecatedFieldRPC; bool fHeadersFirstSyncingActive; int nPoolMaxTransactions; - - //std::string strSporkKey; std::string strSporkKey; - std::string strSporkKeyOld; - int64_t nEnforceNewSporkKey; - int64_t nRejectOldSporkKey; - std::string strObfuscationPoolDummyAddress; int64_t nStartMasternodePayments; std::string zerocoinModulus; diff --git a/src/clientversion.h b/src/clientversion.h index 5222017..fa06c95 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -18,7 +18,7 @@ #define CLIENT_VERSION_MAJOR 1 #define CLIENT_VERSION_MINOR 1 #define CLIENT_VERSION_REVISION 0 -#define CLIENT_VERSION_BUILD 1 +#define CLIENT_VERSION_BUILD 0 //! Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true diff --git a/src/main.cpp b/src/main.cpp index aa86b6f..9027c89 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -112,81 +112,79 @@ const string strMessageMagic = "DarkNet Signed Message:\n"; // Internal stuff namespace { + struct CBlockIndexWorkComparator { + bool operator()(CBlockIndex* pa, CBlockIndex* pb) const + { + // First sort by most total work, ... + if (pa->nChainWork > pb->nChainWork) return false; + if (pa->nChainWork < pb->nChainWork) return true; -struct CBlockIndexWorkComparator { - bool operator()(CBlockIndex* pa, CBlockIndex* pb) const - { - // First sort by most total work, ... - if (pa->nChainWork > pb->nChainWork) return false; - if (pa->nChainWork < pb->nChainWork) return true; - - // ... then by earliest time received, ... - if (pa->nSequenceId < pb->nSequenceId) return false; - if (pa->nSequenceId > pb->nSequenceId) return true; - - // Use pointer address as tie breaker (should only happen with blocks - // loaded from disk, as those all have id 0). - if (pa < pb) return false; - if (pa > pb) return true; - - // Identical blocks. - return false; - } -}; + // ... then by earliest time received, ... + if (pa->nSequenceId < pb->nSequenceId) return false; + if (pa->nSequenceId > pb->nSequenceId) return true; -CBlockIndex* pindexBestInvalid; + // Use pointer address as tie breaker (should only happen with blocks + // loaded from disk, as those all have id 0). + if (pa < pb) return false; + if (pa > pb) return true; -/** - * The set of all CBlockIndex entries with BLOCK_VALID_TRANSACTIONS (for itself and all ancestors) and - * as good as our current tip or better. Entries may be failed, though. - */ -set setBlockIndexCandidates; -/** Number of nodes with fSyncStarted. */ -int nSyncStarted = 0; -/** All pairs A->B, where A (or one if its ancestors) misses transactions, but B has transactions. */ -multimap mapBlocksUnlinked; - -CCriticalSection cs_LastBlockFile; -std::vector vinfoBlockFile; -int nLastBlockFile = 0; + // Identical blocks. + return false; + } + }; -/** - * Every received block is assigned a unique and increasing identifier, so we - * know which one to give priority in case of a fork. - */ -CCriticalSection cs_nBlockSequenceId; -/** Blocks loaded from disk are assigned id 0, so start the counter at 1. */ -uint32_t nBlockSequenceId = 1; + CBlockIndex* pindexBestInvalid; -/** - * Sources of received blocks, to be able to send them reject messages or ban - * them, if processing happens afterwards. Protected by cs_main. - */ -map mapBlockSource; - -/** Blocks that are in flight, and that are in the queue to be downloaded. Protected by cs_main. */ -struct QueuedBlock { - uint256 hash; - CBlockIndex* pindex; //! Optional. - int64_t nTime; //! Time of "getdata" request in microseconds. - int nValidatedQueuedBefore; //! Number of blocks queued with validated headers (globally) at the time this one is requested. - bool fValidatedHeaders; //! Whether this block has validated headers at the time of request. -}; -map::iterator> > mapBlocksInFlight; + /** + * The set of all CBlockIndex entries with BLOCK_VALID_TRANSACTIONS (for itself and all ancestors) and + * as good as our current tip or better. Entries may be failed, though. + */ + set setBlockIndexCandidates; + /** Number of nodes with fSyncStarted. */ + int nSyncStarted = 0; + /** All pairs A->B, where A (or one if its ancestors) misses transactions, but B has transactions. */ + multimap mapBlocksUnlinked; + + CCriticalSection cs_LastBlockFile; + std::vector vinfoBlockFile; + int nLastBlockFile = 0; + + /** + * Every received block is assigned a unique and increasing identifier, so we + * know which one to give priority in case of a fork. + */ + CCriticalSection cs_nBlockSequenceId; + /** Blocks loaded from disk are assigned id 0, so start the counter at 1. */ + uint32_t nBlockSequenceId = 1; -/** Number of blocks in flight with validated headers. */ -int nQueuedValidatedHeaders = 0; + /** + * Sources of received blocks, to be able to send them reject messages or ban + * them, if processing happens afterwards. Protected by cs_main. + */ + map mapBlockSource; + + /** Blocks that are in flight, and that are in the queue to be downloaded. Protected by cs_main. */ + struct QueuedBlock { + uint256 hash; + CBlockIndex* pindex; //! Optional. + int64_t nTime; //! Time of "getdata" request in microseconds. + int nValidatedQueuedBefore; //! Number of blocks queued with validated headers (globally) at the time this one is requested. + bool fValidatedHeaders; //! Whether this block has validated headers at the time of request. + }; + map::iterator> > mapBlocksInFlight; -/** Number of preferable block download peers. */ -int nPreferredDownload = 0; + /** Number of blocks in flight with validated headers. */ + int nQueuedValidatedHeaders = 0; -/** Dirty block index entries. */ -set setDirtyBlockIndex; + /** Number of preferable block download peers. */ + int nPreferredDownload = 0; -/** Dirty block file entries. */ -set setDirtyFileInfo; -} // namespace + /** Dirty block index entries. */ + set setDirtyBlockIndex; + /** Dirty block file entries. */ + set setDirtyFileInfo; +} // anon namespace ////////////////////////////////////////////////////////////////////////////// // @@ -214,7 +212,7 @@ namespace boost::signals2::signal BlockChecked; } g_signals; -} // namespace +} // anon namespace void RegisterValidationInterface(CValidationInterface* pwalletIn) { @@ -551,7 +549,7 @@ namespace } } -} // namespace +} // anon namespace bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) { @@ -2564,8 +2562,8 @@ int64_t GetMasternodePayment(int nHeight, int64_t blockValue, int nMasternodeCou ret = blockValue / 10 * 9; //90% }else if (nHeight > 175000) { ret = blockValue / 10 * 9; //90% - } - return ret; + } + return ret; } //Treasury blocks start from 60,000 and then each block after @@ -2575,16 +2573,24 @@ int nTreasuryBlockStep = 1440; //Put spork toggle to turn on and off. bool IsTreasuryBlock(int nHeight) { + //This is put in for when dev fee is turned off. + if (nHeight < nStartTreasuryBlock) + return false; + else if (IsSporkActive(SPORK_17_TREASURY_PAYMENT_ENFORCEMENT)) + return false; + else if ((nHeight - nStartTreasuryBlock) % nTreasuryBlockStep == 0) + return true; + else + return false; - //This is put in for when dev fee is turned off. - if (nHeight < nStartTreasuryBlock) - return false; - else if (IsSporkActive(SPORK_17_TREASURY_PAYMENT_ENFORCEMENT)) - return false; - else if ((nHeight - nStartTreasuryBlock) % nTreasuryBlockStep == 0) - return true; - else - return false; + /* + if (nHeight < nStartTreasuryBlock) + return false; + else if ((nHeight - nStartTreasuryBlock) % nTreasuryBlockStep == 0) + return true; + else + return false; + */ } int64_t GetTreasuryAward(int nHeight) @@ -2625,19 +2631,28 @@ int nReviveBlockStep = 1440; //Checks to see if block count above is correct if not then no Revive bool IsReviveBlock(int nHeight) { - // Old fee for AQX before admin gave up on project - // CCBC will not pay for revival fee since CCBC dev did all work - // And AQX team didnt help like promised. - if (nHeight < nStartReviveBlock) - return false; - else if (IsSporkActive(SPORK_18_REVIVE_PAYMENT_ENFORCEMENT)) - return false; - else if ((nHeight - nStartReviveBlock) % nReviveBlockStep == 0) - return true; - else - return false; - + // Old fee for AQX before admin gave up on project + // CCBC will not pay for revival fee since CCBC dev did all work + // And AQX team didnt help like promised. + + if (nHeight < nStartReviveBlock) + return false; + else if (IsSporkActive(SPORK_18_REVIVE_PAYMENT_ENFORCEMENT)) + return false; + else if ((nHeight - nStartReviveBlock) % nReviveBlockStep == 0) + return true; + else + return false; + + /* + if (nHeight < nStartReviveBlock) + return false; + else if ((nHeight - nStartReviveBlock) % nReviveBlockStep == 0) + return true; + else + return false; + */ } int64_t GetReviveAward(int nHeight) @@ -3795,11 +3810,10 @@ bool DisconnectBlocksAndReprocess(int blocks) } /* +DisconnectBlockAndInputs - DisconnectBlockAndInputs - Remove conflicting blocks for successful SwiftX transaction locks - This should be very rare (Probably will never happen) - +Remove conflicting blocks for successful SwiftX transaction locks +This should be very rare (Probably will never happen) */ // ***TODO*** clean up here bool DisconnectBlockAndInputs(CValidationState& state, CTransaction txLock) @@ -6781,33 +6795,28 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, // it was the one which was commented out int ActiveProtocol() { - - // SPORK_14 will remove early wallet adopters of protocol 70002 where max supply didnt have cap and - // seesaw masternode amount was set to 5k instead of 25k collateral - /* + // SPORK_14 will remove early wallet adopters of protocol 70002 where max supply didnt have cap and + // seesaw masternode amount was set to 5k instead of 25k collateral + /* if (IsSporkActive(SPORK_14_NEW_PROTOCOL_ENFORCEMENT)) return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT; return MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT; */ - - // SPORK_15 will be used after SPORK_14 is used and commented out from being turned off. - // SPORK_15 has been turned on and will be commented out to prevent from being turned off. - // Approved by TFinch 11/29/2018 - /* - + // SPORK_15 will be used after SPORK_14 is used and commented out from being turned off. + // SPORK_15 has been turned on and will be commented out to prevent from being turned off. + // Approved by TFinch 11/29/2018 + /* if (IsSporkActive(SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2)) return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT; return MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT; */ - - // SPORK_19 will be used after SPORK_15 is used and commented out from being turned off. - // This will be turned on after first of the year to enforce me spork privkey! - if (IsSporkActive(SPORK_19_NEW_PROTOCOL_ENFORCEMENT_3)) - return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT; - return MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT; - + // SPORK_19 will be used after SPORK_15 is used and commented out from being turned off. + // This will be turned on after first of the year to enforce me spork privkey! + if (IsSporkActive(SPORK_19_NEW_PROTOCOL_ENFORCEMENT_3)) + return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT; + return MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT; } // requires LOCK(cs_vRecvMsg) @@ -7217,19 +7226,17 @@ std::string CBlockFileInfo::ToString() const class CMainCleanup { public: + CMainCleanup() {} + ~CMainCleanup() + { + // block headers + BlockMap::iterator it1 = mapBlockIndex.begin(); + for (; it1 != mapBlockIndex.end(); it1++) + delete (*it1).second; + mapBlockIndex.clear(); - CMainCleanup() {} - ~CMainCleanup() - { - // block headers - BlockMap::iterator it1 = mapBlockIndex.begin(); - for (; it1 != mapBlockIndex.end(); it1++) - delete (*it1).second; - mapBlockIndex.clear(); - - // orphan transactions - mapOrphanTransactions.clear(); - mapOrphanTransactionsByPrev.clear(); - } + // orphan transactions + mapOrphanTransactions.clear(); + mapOrphanTransactionsByPrev.clear(); + } } instance_of_cmaincleanup; - diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index 176f385..aab219a 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -19,8 +19,7 @@ Form - - + @@ -38,1406 +37,803 @@ - - - - - - 0 - 350 - - - - Qt::LeftToRight - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Qt::Horizontal - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - 239 - 238 - 238 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 246 - 246 - - - - - - - 119 - 119 - 119 - - - - - - - 159 - 159 - 159 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 239 - 238 - 238 - - - - - - - 0 - 0 - 0 - - - - - - - 247 - 246 - 246 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 239 - 238 - 238 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 246 - 246 - - - - - - - 119 - 119 - 119 - - - - - - - 159 - 159 - 159 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 239 - 238 - 238 - - - - - - - 0 - 0 - 0 - - - - - - - 247 - 246 - 246 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 119 - 119 - 119 - - - - - - - 239 - 238 - 238 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 246 - 246 - - - - - - - 119 - 119 - 119 - - - - - - - 159 - 159 - 159 - - - - - - - 119 - 119 - 119 - - - - - - - 255 - 255 - 255 - - - - - - - 119 - 119 - 119 - - - - - - - 239 - 238 - 238 - - - - - - - 239 - 238 - 238 - - - - - - - 0 - 0 - 0 - - - - - - - 239 - 238 - 238 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - Qt::NoFocus - - - true - - - - - - true - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - 75 - true - - - - CCBC Balances - - - - - - - WhatsThisCursor - - - The displayed information may be out of date. Your wallet automatically synchronizes with the CCBC network after a connection is established, but this process has not completed yet. - - - QLabel { color: red; } - - - (out of sync) - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 12 - - - - - - 75 - true - - - - IBeamCursor - - - Unconfirmed transactions to watch-only addresses - - - 0.000 000 00 CCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - IBeamCursor - - - Total of transactions that have yet to be confirmed, and do not yet count toward the spendable balance - - - 0.000 000 00 CCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - IBeamCursor - - - Staked or masternode rewards in watch-only addresses that has not yet matured - - - 0.000 000 00 CCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - - 140 - 0 - - - - Qt::Horizontal - - - - - - - Total: - - - - - - - - 75 - true - - - - IBeamCursor - - - Staked or masternode rewards that has not yet matured - - - 0.000 000 00 CCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Immature: - - - - - - - - 75 - true - - - - IBeamCursor - - - Your current total balance - - - 0.000 000 00 CCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - IBeamCursor - - - Current total balance in watch-only addresses - - - 0.000 000 00 CCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Watch-only: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Available: - - - - - - - - 75 - true - - - - IBeamCursor - - - Your current spendable balance - - - 0.000 000 00 CCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - IBeamCursor - - - Your current balance in watch-only addresses - - - 0.000 000 00 CCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Pending: - - - - - - - Spendable: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - 16777215 - 20 - - - - - 75 - true - - - - Combined Balances (including unconfirmed and immature coins) - - - <html><head/><body><p>Combined Balances</p></body></html> - - - - - - - - - 12 - - - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - - 140 - 0 - - - - Qt::Horizontal - - - - - - - - 75 - true - - - - IBeamCursor - - - Total of transactions that have yet to be confirmed, and do not yet count toward the spendable balance - - - 0.000 000 00 CCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 75 - true - - - - IBeamCursor - - - Total Balance, including unconfirmed and immature coins. - - - 0.000 000 00 CCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Total: - - - - - - - CCBC: - - - - - - - - 75 - true - - - - IBeamCursor - - - Your current spendable balance - - - 0.000 000 00 CCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - zCCBC: - - - - - - - - Current percentage of zCCBC. - If AutoMint is enabled this percentage will settle around the configured AutoMint percentage (default = 10%) - - - - 0 % - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Locked CCBC or Masternode collaterals. These are excluded from zCCBC minting. - - - 0.000 000 00 CCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Locked CCBC or Masternode collaterals. These are excluded from zCCBC minting. - - - Locked: - - - - - - - Unlocked CCBCs. These can be used for zCCBC minting. - - - Unlocked: - - - - - - - Unlocked CCBCs. These can be used for zCCBC minting. - - - 0.000 000 00 CCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 0 % - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - 16777215 - 20 - - - - - 75 - true - - - - zCCBC Balance - - - - - - - - - 12 - - - - - - Mature: more than 20 confirmation and more than 1 mints of the same denomination after it was minted. - These zCCBC are spendable. - - - - Mature: - - - - - - - Qt::Horizontal - - - - - - - - 75 - true - - - - IBeamCursor - - - All available zCCBC, unconfirmed and immature zCCBC included. - - - 0.000 000 00 zCCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 0 - 0 - - - - - 140 - 0 - - - - Qt::Horizontal - - - - - - - All available zCCBC, unconfirmed and immature zCCBC included. - - - Total: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 75 - true - - - - - Mature: more than 20 confirmation and more than 1 mints of the same denomination after it was minted. - These zCCBC are spendable. - - - - 0.000 000 00 zCCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - Unconfirmed: less than 20 confirmations - Immature: confirmed, but less than 1 mints of the same denomination after it was minted - - - - Unconfirmed: - - - - - - - - 75 - true - - - - - Unconfirmed: less than 20 confirmations - Immature: confirmed, but less than 1 mints of the same denomination after it was minted - - - - 0.000 000 00 zCCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - Unconfirmed: less than 20 confirmations - Immature: confirmed, but less than 1 mints of the same denomination after it was minted - - - - Immature: - - - - - - - - 75 - true - - - - - Unconfirmed: less than 20 confirmations - Immature: confirmed, but less than 1 mints of the same denomination after it was minted - - - - 0.000 000 00 zCCBC - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 0 + + + + + + + + + + + + + 75 + true + + + + Recent transactions + + + + + + + WhatsThisCursor + + + The displayed information may be out of date. Your wallet automatically synchronizes with the CCBC network after a connection is established, but this process has not completed yet. + + + QLabel { color: red; } + + + (out of sync) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 75 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 75 + + + + + + + + QListView { background: transparent; } + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractItemView::NoSelection + + + + + + + - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 75 - - - - - - + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 75 + true + + + + CCBC Balances + + + + + + + WhatsThisCursor + + + The displayed information may be out of date. Your wallet automatically synchronizes with the CCBC network after a connection is established, but this process has not completed yet. + + + QLabel { color: red; } + + + (out of sync) + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 12 + + + + + + 75 + true + + + + IBeamCursor + + + Current total balance in watch-only addresses + + + 0.000 000 00 CCBC + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 75 + true + + + + IBeamCursor + + + Your current spendable balance + + + 0.000 000 00 CCBC + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 75 + true + + + + IBeamCursor + + + Your current balance in watch-only addresses + + + 0.000 000 00 CCBC + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + Pending: + + + + + + + Spendable: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 75 + true + + + + IBeamCursor + + + Total of transactions that have yet to be confirmed, and do not yet count toward the spendable balance + + + 0.000 000 00 CCBC + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 75 + true + + + + IBeamCursor + + + Staked or masternode rewards in watch-only addresses that has not yet matured + + + 0.000 000 00 CCBC + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 75 + true + + + + IBeamCursor + + + Unconfirmed transactions to watch-only addresses + + + 0.000 000 00 CCBC + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + Qt::Horizontal + + + + + + + + 75 + true + + + + IBeamCursor + + + Staked or masternode rewards that has not yet matured + + + 0.000 000 00 CCBC + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 0 + 0 + + + + + 140 + 0 + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Total: + + + + + + + Immature: + + + + + + + Available: + + + + + + + + 75 + true + + + + IBeamCursor + + + Your current total balance + + + 0.000 000 00 CCBC + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + Watch-only: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 140 + 0 + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + + - - - - 75 - true - - - - Recent transactions - - + + + + + + 75 + true + + + + Masternode Info + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - WhatsThisCursor - - - The displayed information may be out of date. Your wallet automatically synchronizes with the CCBC network after a connection is established, but this process has not completed yet. - - - QLabel { color: red; } - - - (out of sync) + + + 12 - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + 75 + true + + + + IBeamCursor + + + Total of transactions that have yet to be confirmed, and do not yet count toward the spendable balance + + + 0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + Collateral: + + + + + + + Days Till ROI: + + + + + + + + 75 + true + + + + IBeamCursor + + + Your current total balance + + + 0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 75 + true + + + + IBeamCursor + + + Staked or masternode rewards that has not yet matured + + + 0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + MN Online: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 75 + true + + + + IBeamCursor + + + Your current spendable balance + + + 25,000 CCBC + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Daily Rewards: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 140 + 0 + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + + + + + + + + + 75 + true + + + + Network Information + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 12 @@ -1647,66 +1043,17 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - QListView { background: transparent; } - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - QAbstractItemView::NoSelection - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - + + + - + diff --git a/src/qt/forms/privacydialog.ui b/src/qt/forms/privacydialog.ui index 917d940..ba89cca 100644 --- a/src/qt/forms/privacydialog.ui +++ b/src/qt/forms/privacydialog.ui @@ -673,155 +673,21 @@ - - - - - 460 - 0 - - - - - 16777215 - 48 - - - - - 14 - 75 - true - - - - CCBC which were anonymized via Zerocin Protocol - - - true - - - Zerocoin CCBC (zCCBC) - - - Qt::AlignCenter - - - - - - - - 16777215 - 1 - - - - Qt::Horizontal - - - - - - - - - Denominations with value 50: - - - Denom. with value 50: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 40 - 0 - - - - - Unconfirmed: less than 20 confirmations - Immature: confirmed, but less than 1 mint of the same denomination after it was minted - - - - 0 x - - - Qt::RichText - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - Denom. 1: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 0 zCCBC - - - - - - - + + - + - Denominations with value 5: + Denominations with value 10: - Denom. with value 5: + Denom. with value 10: Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -829,7 +695,7 @@ - + Qt::Horizontal @@ -842,7 +708,7 @@ - + 40 @@ -868,118 +734,6 @@ - - - - - - - Show the current status of automatic zCCBC minting. - - To change the status (restart required): - - enable: add 'enablezeromint=1' to pivx.conf - - disable: add 'enablezeromint=0' to pivx.conf - - To change the percentage (no restart required): - - menu Settings->Options->Percentage of autominted zCCBC - - - - - AutoMint Status - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 75 - true - - - - Automint Is Disabled - - - - - - - - - - 0 - 1 - - - - - 16777215 - 1 - - - - Qt::Horizontal - - - - - - - - - - 75 - true - - - - Global Supply: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 75 - true - - - - 0 zCCBC - - - - - @@ -1146,30 +900,11 @@ 40 20 - - - - - - - - - - - 0 - 1 - - - - - 16777215 - 1 - - - - Qt::Horizontal - - + + + + + @@ -1226,6 +961,25 @@ + + + + + 0 + 1 + + + + + 16777215 + 1 + + + + Qt::Horizontal + + + @@ -1367,22 +1121,6 @@ - - - - Qt::Vertical - - - QSizePolicy::Maximum - - - - 20 - 13 - - - - @@ -1414,6 +1152,22 @@ + + + + Qt::Vertical + + + QSizePolicy::Maximum + + + + 20 + 13 + + + + @@ -1453,15 +1207,218 @@ Denominations with value 1: - Denom. with value 1: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Denom. with value 1: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 40 + 0 + + + + + Unconfirmed: less than 20 confirmations + Immature: confirmed, but less than 1 mint of the same denomination after it was minted + + + + 0 x + + + Qt::RichText + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + Denominations with value 50: + + + Denom. with value 50: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 40 + 0 + + + + + Unconfirmed: less than 20 confirmations + Immature: confirmed, but less than 1 mint of the same denomination after it was minted + + + + 0 x + + + Qt::RichText + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + Denom. 1: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 0 zCCBC + + + + + + + + + + + Denominations with value 5: + + + Denom. with value 5: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 40 + 0 + + + + + Unconfirmed: less than 20 confirmations + Immature: confirmed, but less than 1 mint of the same denomination after it was minted + + + + 0 x + + + Qt::RichText + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + Show the current status of automatic zCCBC minting. + + To change the status (restart required): + - enable: add 'enablezeromint=1' to ccbc.conf + - disable: add 'enablezeromint=0' to ccbc.conf + + To change the percentage (no restart required): + - menu Settings->Options->Percentage of autominted zCCBC + + + + + AutoMint Status - + Qt::Horizontal @@ -1474,49 +1431,56 @@ - - - - 40 - 0 - - - - - Unconfirmed: less than 20 confirmations - Immature: confirmed, but less than 1 mint of the same denomination after it was minted - + + + + 75 + true + - 0 x - - - Qt::RichText - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Automint Is Disabled - - + + + + + 0 + 1 + + + + + 16777215 + 1 + + + + Qt::Horizontal + + + + + - - - Denominations with value 10: + + + + 75 + true + - Denom. with value 10: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Global Supply: - + Qt::Horizontal @@ -1529,27 +1493,15 @@ - - - - 40 - 0 - - - - - Unconfirmed: less than 20 confirmations - Immature: confirmed, but less than 1 mint of the same denomination after it was minted - + + + + 75 + true + - 0 x - - - Qt::RichText - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + 0 zCCBC @@ -1776,17 +1728,17 @@ - - + + - + - Denom. 500: + Denom. 5000: - + Qt::Horizontal @@ -1799,7 +1751,7 @@ - + 0 zCCBC @@ -1807,17 +1759,17 @@ - - + + - + - Denom. 5000: + Denom. 500: - + Qt::Horizontal @@ -1830,7 +1782,7 @@ - + 0 zCCBC @@ -1838,25 +1790,6 @@ - - - - - 16777215 - 20 - - - - - 75 - true - - - - Zerocoin Transactional Information - - - @@ -1888,10 +1821,42 @@ + + + + + 16777215 + 20 + + + + + 75 + true + + + + Zerocoin Transactional Information + + + + + + + + 1 + 16777215 + + + + Qt::Vertical + + + @@ -2538,7 +2503,7 @@ - + :/icons/address-book:/icons/address-book @@ -2555,7 +2520,7 @@ - + :/icons/editpaste:/icons/editpaste @@ -2696,46 +2661,8 @@ - - - - - 1 - 16777215 - - - - Qt::Vertical - - - - - - - false - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - 3 - - - @@ -2773,10 +2700,57 @@ + + + + + 460 + 0 + + + + + 16777215 + 48 + + + + + 14 + 75 + true + + + + CCBC which were anonymized via Zerocin Protocol + + + true + + + Zerocoin CCBC (zCCBC) + + + Qt::AlignCenter + + + + + + + + 16777215 + 1 + + + + Qt::Horizontal + + + zCCBCLabel line_2 - labelCoinControlChangeLabel dummyHideWidget WarningLabel labelCoinControlAfterFee @@ -2789,7 +2763,7 @@ - + diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 4e3d189..abe370a 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -180,23 +180,10 @@ OverviewPage::~OverviewPage() /* void OverviewPage::getPercentage(CAmount nUnlockedBalance, CAmount nZerocoinBalance, QString& sCCBCPercentage, QString& szCCBCPercentage) { - int nPrecision = 2; - double dzPercentage = 0.0; - - if (nZerocoinBalance <= 0) { - dzPercentage = 0.0; - } else { - if (nUnlockedBalance <= 0) { - dzPercentage = 100.0; - } else { - dzPercentage = 100.0 * (double)(nZerocoinBalance / (double)(nZerocoinBalance + nUnlockedBalance)); - } - } - - double dPercentage = 100.0 - dzPercentage; - - szCCBCPercentage = "(" + QLocale(QLocale::system()).toString(dzPercentage, 'f', nPrecision) + " %)"; - sCCBCPercentage = "(" + QLocale(QLocale::system()).toString(dPercentage, 'f', nPrecision) + " %)"; +int nPrecision = 2; +double dzPercentage = 0.0; +if (nZerocoinBalance <= 0){ +dzPercentage = 0.0; } else{ if (nUnlockedBalance <= 0){ @@ -208,83 +195,94 @@ dzPercentage = 100.0 * (double)(nZerocoinBalance / (double)(nZerocoinBalance + n } double dPercentage = 100.0 - dzPercentage; -void OverviewPage::setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance, const CAmount& zerocoinBalance, const CAmount& unconfirmedZerocoinBalance, const CAmount& immatureZerocoinBalance, const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance) +szCCBCPercentage = "(" + QLocale(QLocale::system()).toString(dzPercentage, 'f', nPrecision) + " %)"; +sCCBCPercentage = "(" + QLocale(QLocale::system()).toString(dPercentage, 'f', nPrecision) + " %)"; + +} +*/ + +void OverviewPage::setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance, + //const CAmount& zerocoinBalance, const CAmount& unconfirmedZerocoinBalance, const CAmount& immatureZerocoinBalance, + const CAmount& watchOnlyBalance, + const CAmount& watchUnconfBalance, + const CAmount& watchImmatureBalance) { - currentBalance = balance; - currentUnconfirmedBalance = unconfirmedBalance; - currentImmatureBalance = immatureBalance; - currentZerocoinBalance = zerocoinBalance; - currentUnconfirmedZerocoinBalance = unconfirmedZerocoinBalance; - currentimmatureZerocoinBalance = immatureZerocoinBalance; - currentWatchOnlyBalance = watchOnlyBalance; - currentWatchUnconfBalance = watchUnconfBalance; - currentWatchImmatureBalance = watchImmatureBalance; - - // CCBC labels - ui->labelBalance->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, balance - immatureBalance, false, BitcoinUnits::separatorAlways)); - ui->labelzBalance->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, zerocoinBalance, false, BitcoinUnits::separatorAlways)); - ui->labelUnconfirmed->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, unconfirmedBalance, false, BitcoinUnits::separatorAlways)); - ui->labelImmature->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, immatureBalance, false, BitcoinUnits::separatorAlways)); - ui->labelTotal->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, balance + unconfirmedBalance, false, BitcoinUnits::separatorAlways)); - - // Watchonly labels - ui->labelWatchAvailable->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchOnlyBalance, false, BitcoinUnits::separatorAlways)); - ui->labelWatchPending->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchUnconfBalance, false, BitcoinUnits::separatorAlways)); - ui->labelWatchImmature->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchImmatureBalance, false, BitcoinUnits::separatorAlways)); - ui->labelWatchTotal->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchOnlyBalance + watchUnconfBalance + watchImmatureBalance, false, BitcoinUnits::separatorAlways)); - - // zCCBC labels - QString szPercentage = ""; - QString sPercentage = ""; - CAmount nLockedBalance = 0; - if (pwalletMain) { - nLockedBalance = pwalletMain->GetLockedCoins(); - } - ui->labelLockedBalance->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, nLockedBalance, false, BitcoinUnits::separatorAlways)); - - CAmount nTotalBalance = balance + unconfirmedBalance; - CAmount nUnlockedBalance = nTotalBalance - nLockedBalance; - CAmount matureZerocoinBalance = zerocoinBalance - immatureZerocoinBalance; - getPercentage(nUnlockedBalance, zerocoinBalance, sPercentage, szPercentage); - - ui->labelBalancez->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, nTotalBalance, false, BitcoinUnits::separatorAlways)); - ui->labelzBalancez->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, zerocoinBalance, false, BitcoinUnits::separatorAlways)); - ui->labelzBalanceImmature->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, immatureZerocoinBalance, false, BitcoinUnits::separatorAlways)); - ui->labelzBalanceUnconfirmed->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, unconfirmedZerocoinBalance, false, BitcoinUnits::separatorAlways)); - ui->labelzBalanceMature->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, matureZerocoinBalance, false, BitcoinUnits::separatorAlways)); - ui->labelTotalz->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, nTotalBalance + zerocoinBalance, false, BitcoinUnits::separatorAlways)); - ui->labelUnLockedBalance->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, nUnlockedBalance, false, BitcoinUnits::separatorAlways)); - ui->labelCCBCPercent->setText(sPercentage); - ui->labelzCCBCPercent->setText(szPercentage); - - // Adjust bubble-help according to AutoMint settings - QString automintHelp = tr("Current percentage of zCCBC.\nIf AutoMint is enabled this percentage will settle around the configured AutoMint percentage (default = 10%).\n"); - bool fEnableZeromint = GetBoolArg("-enablezeromint", false); - int nZeromintPercentage = GetArg("-zeromintpercentage", 10); - if (fEnableZeromint) { - automintHelp += tr("AutoMint is currently enabled and set to ") + QString::number(nZeromintPercentage) + "%.\n"; - automintHelp += tr("To disable AutoMint delete set 'enablezeromint=1' to 'enablezeromint=0' in ccbc.conf."); - } else { - automintHelp += tr("AutoMint is currently disabled.\nTo enable AutoMint add 'enablezeromint=1' in ccbc.conf"); - } - ui->labelzCCBCPercent->setToolTip(automintHelp); - - // only show immature (newly mined) balance if it's non-zero, so as not to complicate things - // for the non-mining users - bool showImmature = immatureBalance != 0; - bool showWatchOnlyImmature = watchImmatureBalance != 0; - - // for symmetry reasons also show immature label when the watch-only one is shown - ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature); - ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature); - ui->labelWatchImmature->setVisible(showWatchOnlyImmature); // show watch-only immature balance - - static int cachedTxLocks = 0; - - if (cachedTxLocks != nCompleteTXLocks) { - cachedTxLocks = nCompleteTXLocks; - ui->listTransactions->update(); - } + currentBalance = balance; + currentUnconfirmedBalance = unconfirmedBalance; + currentImmatureBalance = immatureBalance; + //currentZerocoinBalance = zerocoinBalance; + //currentUnconfirmedZerocoinBalance = unconfirmedZerocoinBalance; + //currentimmatureZerocoinBalance = immatureZerocoinBalance; + currentWatchOnlyBalance = watchOnlyBalance; + currentWatchUnconfBalance = watchUnconfBalance; + currentWatchImmatureBalance = watchImmatureBalance; + + // CCBC labels + ui->labelBalance->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, balance - immatureBalance, false, BitcoinUnits::separatorAlways)); + //ui->labelzBalance->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, zerocoinBalance, false, BitcoinUnits::separatorAlways)); + ui->labelUnconfirmed->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, unconfirmedBalance, false, BitcoinUnits::separatorAlways)); + ui->labelImmature->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, immatureBalance, false, BitcoinUnits::separatorAlways)); + ui->labelTotal->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, balance + unconfirmedBalance, false, BitcoinUnits::separatorAlways)); + + // Watchonly labels + ui->labelWatchAvailable->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchOnlyBalance, false, BitcoinUnits::separatorAlways)); + ui->labelWatchPending->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchUnconfBalance, false, BitcoinUnits::separatorAlways)); + ui->labelWatchImmature->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchImmatureBalance, false, BitcoinUnits::separatorAlways)); + ui->labelWatchTotal->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, watchOnlyBalance + watchUnconfBalance + watchImmatureBalance, false, BitcoinUnits::separatorAlways)); + + + //zCCBC labels + /* + QString szPercentage = ""; + QString sPercentage = ""; + CAmount nLockedBalance = 0; + if (pwalletMain) { + nLockedBalance = pwalletMain->GetLockedCoins(); + } + ui->labelLockedBalance->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, nLockedBalance, false, BitcoinUnits::separatorAlways)); + CAmount nTotalBalance = balance + unconfirmedBalance; + CAmount nUnlockedBalance = nTotalBalance - nLockedBalance; + CAmount matureZerocoinBalance = zerocoinBalance - immatureZerocoinBalance; + getPercentage(nUnlockedBalance, zerocoinBalance, sPercentage, szPercentage); + ui->labelBalancez->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, nTotalBalance, false, BitcoinUnits::separatorAlways)); + ui->labelzBalancez->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, zerocoinBalance, false, BitcoinUnits::separatorAlways)); + ui->labelzBalanceImmature->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, immatureZerocoinBalance, false, BitcoinUnits::separatorAlways)); + ui->labelzBalanceUnconfirmed->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, unconfirmedZerocoinBalance, false, BitcoinUnits::separatorAlways)); + ui->labelzBalanceMature->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, matureZerocoinBalance, false, BitcoinUnits::separatorAlways)); + ui->labelTotalz->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, nTotalBalance + zerocoinBalance, false, BitcoinUnits::separatorAlways)); + ui->labelUnLockedBalance->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, nUnlockedBalance, false, BitcoinUnits::separatorAlways)); + ui->labelCCBCPercent->setText(sPercentage); + ui->labelzCCBCPercent->setText(szPercentage); + // Adjust bubble-help according to AutoMint settings + QString automintHelp = tr("Current percentage of zCCBC.\nIf AutoMint is enabled this percentage will settle around the configured AutoMint percentage (default = 10%).\n"); + bool fEnableZeromint = GetBoolArg("-enablezeromint", false); + int nZeromintPercentage = GetArg("-zeromintpercentage", 10); + if (fEnableZeromint) { + automintHelp += tr("AutoMint is currently enabled and set to ") + QString::number(nZeromintPercentage) + "%.\n"; + automintHelp += tr("To disable AutoMint delete set 'enablezeromint=1' to 'enablezeromint=0' in ccbc.conf."); + } + else { + automintHelp += tr("AutoMint is currently disabled.\nTo enable AutoMint add 'enablezeromint=1' in ccbc.conf"); + } + ui->labelzCCBCPercent->setToolTip(automintHelp); + */ + + //only show immature (newly mined) balance if it's non-zero, so as not to complicate things + //for the non-mining users + bool showImmature = immatureBalance != 0; + bool showWatchOnlyImmature = watchImmatureBalance != 0; + + // for symmetry reasons also show immature label when the watch-only one is shown + ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature); + ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature); + ui->labelWatchImmature->setVisible(showWatchOnlyImmature); // show watch-only immature balance + + static int cachedTxLocks = 0; + + if (cachedTxLocks != nCompleteTXLocks) { + cachedTxLocks = nCompleteTXLocks; + ui->listTransactions->update(); + } } // show/hide watch-only labels @@ -322,35 +320,39 @@ void OverviewPage::setClientModel(ClientModel* model) void OverviewPage::setWalletModel(WalletModel* model) { - this->walletModel = model; - if (model && model->getOptionsModel()) { - // Set up transaction list - filter = new TransactionFilterProxy(); - filter->setSourceModel(model->getTransactionTableModel()); - filter->setLimit(NUM_ITEMS); - filter->setDynamicSortFilter(true); - filter->setSortRole(Qt::EditRole); - filter->setShowInactive(false); - filter->sort(TransactionTableModel::Date, Qt::DescendingOrder); - - ui->listTransactions->setModel(filter); - ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress); - - // Keep up to date with wallet - setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance(), - model->getZerocoinBalance(), model->getUnconfirmedZerocoinBalance(), model->getImmatureZerocoinBalance(), - model->getWatchBalance(), model->getWatchUnconfirmedBalance(), model->getWatchImmatureBalance()); - connect(model, SIGNAL(balanceChanged(CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount)), this, - SLOT(setBalance(CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount))); - - connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); - - updateWatchOnlyLabels(model->haveWatchOnly()); - connect(model, SIGNAL(notifyWatchonlyChanged(bool)), this, SLOT(updateWatchOnlyLabels(bool))); - } - - // update the display unit, to not use the default ("CCBC") - updateDisplayUnit(); + this->walletModel = model; + if (model && model->getOptionsModel()) { + // Set up transaction list + filter = new TransactionFilterProxy(); + filter->setSourceModel(model->getTransactionTableModel()); + filter->setLimit(NUM_ITEMS); + filter->setDynamicSortFilter(true); + filter->setSortRole(Qt::EditRole); + filter->setShowInactive(false); + filter->sort(TransactionTableModel::Date, Qt::DescendingOrder); + + ui->listTransactions->setModel(filter); + ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress); + + // Keep up to date with wallet + setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance(), + //setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance(), + //model->getZerocoinBalance(), model->getUnconfirmedZerocoinBalance(), model->getImmatureZerocoinBalance(), + model->getWatchBalance(), model->getWatchUnconfirmedBalance(), model->getWatchImmatureBalance()); + //connect(model, SIGNAL(balanceChanged(CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount)), this, + //SLOT(setBalance(CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount, CAmount))); + connect(model, SIGNAL(balanceChanged(CAmount, CAmount, CAmount, CAmount, CAmount, CAmount)), this, + SLOT(setBalance(CAmount, CAmount, CAmount, CAmount, CAmount, CAmount))); + + + connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); + + updateWatchOnlyLabels(model->haveWatchOnly()); + //connect(model, SIGNAL(notifyWatchonlyChanged(bool)), this, SLOT(updateWatchOnlyLabels(bool))); + } + + // update the display unit, to not use the default ("CCBC") + updateDisplayUnit(); } void OverviewPage::updateDisplayUnit() @@ -489,6 +491,35 @@ void OverviewPage::updateAlerts(const QString& warnings) void OverviewPage::showOutOfSyncWarning(bool fShow) { - ui->labelWalletStatus->setVisible(fShow); - ui->labelTransactionsStatus->setVisible(fShow); + ui->labelWalletStatus->setVisible(fShow); + ui->labelTransactionsStatus->setVisible(fShow); +} + +//Button will be released in next update when they are fine tuned. + +/* +void OverviewPage::pushButton_Website() +{ +QDesktopServices::openUrl(QUrl("https://ccbcoin.club/", QUrl::TolerantMode)); +} + +void OverviewPage::pushButton_Explorer() +{ +QDesktopServices::openUrl(QUrl("https://explorer.ccbcoin.club/#/", QUrl::TolerantMode)); +} + +void OverviewPage::pushButton_Github() +{ +QDesktopServices::openUrl(QUrl("https://github.com/CryptoCashBack-Hub/CCBC", QUrl::TolerantMode)); +} + +void OverviewPage::pushButton_Discord() +{ +QDesktopServices::openUrl(QUrl("https://discord.gg/MVVGzv6", QUrl::TolerantMode)); +} + +void OverviewPage::pushButton_Twitter() +{ +QDesktopServices::openUrl(QUrl("https://twitter.com/CCBcoin", QUrl::TolerantMode)); } +*/ \ No newline at end of file diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h index 0691f3a..bbdb737 100644 --- a/src/qt/overviewpage.h +++ b/src/qt/overviewpage.h @@ -38,7 +38,9 @@ class OverviewPage : public QWidget void showOutOfSyncWarning(bool fShow); public slots: - void setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance, const CAmount& zerocoinBalance, const CAmount& unconfirmedZerocoinBalance, const CAmount& immatureZerocoinBalance, const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance); + void setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance, + //const CAmount& zerocoinBalance, const CAmount& unconfirmedZerocoinBalance, const CAmount& immatureZerocoinBalance, + const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance); signals: void transactionClicked(const QModelIndex& index); @@ -79,4 +81,4 @@ private slots: void updatBlockChainInfo(); }; -#endif // BITCOIN_QT_OVERVIEWPAGE_H \ No newline at end of file +#endif // BITCOIN_QT_OVERVIEWPAGE_H diff --git a/src/qt/privacydialog.cpp b/src/qt/privacydialog.cpp index 54e1927..1225151 100644 --- a/src/qt/privacydialog.cpp +++ b/src/qt/privacydialog.cpp @@ -664,11 +664,7 @@ void PrivacyDialog::setBalance(const CAmount& balance, const CAmount& unconfirme nLockedBalance = walletModel->getLockedBalance(); } - //ui->labelzBalance->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, zerocoinBalance, false, BitcoinUnits::separatorAlways)); - - //ui->labelzAvailableAmount->setText(QString::number(zerocoinBalance / COIN) + QString(" zCCBC ")); - //ui->labelzAvailableAmount_2->setText(QString::number(matureZerocoinBalance / COIN) + QString(" zCCBC ")); - //ui->labelzCCBCAmountValue->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, balance - immatureBalance - nLockedBalance, false, BitcoinUnits::separatorAlways)); + ui->labelzBalance->setText(BitcoinUnits::floorHtmlWithUnit(nDisplayUnit, zerocoinBalance, false, BitcoinUnits::separatorAlways)); if (pwalletMain) { nLockedBalance = pwalletMain->GetLockedCoins(); diff --git a/src/qt/res/css/default.css b/src/qt/res/css/default.css index 3efaa0b..52d9842 100644 --- a/src/qt/res/css/default.css +++ b/src/qt/res/css/default.css @@ -705,78 +705,10 @@ QWidget#AddressBookPage { QWidget#AddressBookPage QHeaderView::section { /* Min width for Windows fix */ min-width: 260px; - - QWidget#AddressBookPage QPushButton#newAddress:pressed { - border: 1px solid #9e9e9e; - } -QWidget#PrivacyDialog QFrame { - background-color: transparent; - border: 1px solid #000; -} - - QWidget#PrivacyDialog QFrame#labelMintStatus { - /* background-color:transparent; */ - background-color: #eee; - /* border-style: inset; */ - /* border-width:2; */ - /* border:2px solid #00; */ - border: 1px inset gray; - } - -QWidget#PrivacyDialog QLabel { - border: 0px solid #000; -} - - QWidget#PrivacyDialog QLabel#zCCBCLabel { - font-size: 14px; - color: #ffffff; - background-color: #fab43b; } - QWidget#PrivacyDialog QLabel#oCCBCLabel { - font-size: 14px; - color: #ffffff; - background-color: #fab43b; - } -QWidget#PrivacyDialog QPushButton { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #cf8107, stop: .1 #fab43b, stop: .95 #fab43b, stop: 1 #e28901); - border: 0; - border-radius: 3px; - color: #ffffff; - font-size: 12px; - font-weight: normal; - padding-left: 5px; - padding-right: 5px; - padding-top: 5px; - padding-bottom: 5px; -} - QWidget#PrivacyDialog QPushButton:hover { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #f3a90f, stop: .1 #f39910, stop: .95 #f39910, stop: 1 #f3a90f); - } - - QWidget#PrivacyDialog QPushButton:focus { - border: none; - outline: none; - } - - QWidget#PrivacyDialog QPushButton:pressed { - border: 1px solid #333; - } - -QWidget#PrivacyDialog QProgressBar#obfuscationProgress { /* Obfuscation Completion */ - border: 1px solid #818181; - border-radius: 1px; - margin-right: 43px; - text-align: right; - color: #818181; -} - - QWidget#PrivacyDialog QProgressBar#obfuscationProgress::chunk { - background-color: #fab43b; - width: 1px; - } /**************************** SETTINGS MENU *********************************************/ @@ -904,6 +836,232 @@ QDialog#EditAddressDialog QLabel { /***************************************************************************************/ /**************************************************************************************/ +QWidget#PrivacyDialog QFrame { + background-color: transparent; + border: 1px solid #000; +} + + QWidget#PrivacyDialog QFrame#labelMintStatus { + /* background-color:transparent; */ + background-color: #eee; + /* border-style: inset; */ + /* border-width:2; */ + /* border:2px solid #00; */ + border: 1px inset gray; + } + +QWidget#PrivacyDialog QLabel { + border: 0px solid #000; +} + + QWidget#PrivacyDialog QLabel#zCCBCLabel { + font-size: 14px; + color: #ffffff; + background-color: #fab43b; + } + + QWidget#PrivacyDialog QLabel#oCCBCLabel { + font-size: 14px; + color: #ffffff; + background-color: #fab43b; + } + +QWidget#PrivacyDialog QPushButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #cf8107, stop: .1 #fab43b, stop: .95 #fab43b, stop: 1 #e28901); + border: 0; + border-radius: 3px; + color: #ffffff; + font-size: 12px; + font-weight: normal; + padding-left: 5px; + padding-right: 5px; + padding-top: 5px; + padding-bottom: 5px; +} + + QWidget#PrivacyDialog QPushButton:hover { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #f3a90f, stop: .1 #f39910, stop: .95 #f39910, stop: 1 #f3a90f); + } + + QWidget#PrivacyDialog QPushButton:focus { + border: none; + outline: none; + } + + QWidget#PrivacyDialog QPushButton:pressed { + border: 1px solid #333; + } + +QWidget#PrivacyDialog QProgressBar#obfuscationProgress { /* Obfuscation Completion */ + border: 1px solid #818181; + border-radius: 1px; + margin-right: 43px; + text-align: right; + color: #818181; +} + + QWidget#PrivacyDialog QProgressBar#obfuscationProgress::chunk { + background-color: #fab43b; + width: 1px; + } + +QWidget .QFrame#frame_4 .QLabel#label_5z_3 { /* Zerocoin Balance Label */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + min-width: 160px; + background-color: transparent; + color: #333; + font-weight: bold; + font-size: 14px; + margin-right: 5px; + padding-right: 5px; +} + +QWidget .QFrame#frame_4 .QLabel#labelzBalanceText { /* Available zCCBC Label */ + qproperty-alignment: 'AlignVCenter | AlignRight'; + min-width: 160px; + background-color: #333; + color: #fff; + margin-right: 5px; + padding-right: 5px; + font-weight: bold; + font-size: 14px; + /* min-height:35px; */ +} + +QWidget .QFrame#frame_4 .QLabel#labelzBalance { /* Available zCCBC Balance */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + font-weight: bold; + color: #fab43b; + margin-left: 0px; +} + +QWidget .QFrame#frame_4 .QLabel#labelzBalanceUnconfirmedText { /* Unconfirmed zCCBC Label */ + qproperty-alignment: 'AlignVCenter | AlignRight'; + min-width: 160px; + background-color: #333; + color: #fff; + margin-right: 5px; + padding-right: 5px; + font-weight: bold; + font-size: 14px; + /* min-height:35px; */ +} + +QWidget .QFrame#frame_4 .QLabel#labelzBalanceUnconfirmed { /* Unconfirmed zCCBC Balance */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + font-weight: bold; + color: #333; + margin-left: 0px; +} + +QWidget .QFrame#frame_4 .QLabel#labelzBalanceMatureText { /* Mature zCCBC Label */ + qproperty-alignment: 'AlignVCenter | AlignRight'; + min-width: 160px; + background-color: #333; + color: #fff; + margin-right: 5px; + padding-right: 5px; + font-weight: bold; + font-size: 14px; + /* min-height:35px; */ +} + +QWidget .QFrame#frame_4 .QLabel#labelzBalanceMature { /* Mature zCCBC Balance */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + font-weight: bold; + color: #333; + margin-left: 0px; +} + +QWidget .QFrame#frame_4 .QLabel#labelzBalanceImmatureText { /* Immature zCCBC Label */ + qproperty-alignment: 'AlignVCenter | AlignRight'; + min-width: 160px; + background-color: #333; + color: #fff; + margin-right: 5px; + padding-right: 5px; + font-weight: bold; + font-size: 14px; + /* min-height:35px; */ +} + +QWidget .QFrame#frame_4 .QLabel#labelzBalanceImmature { /* Immature zCCBC Balance */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + font-weight: bold; + color: #333; + margin-left: 0px; +} + +QWidget .QFrame#frame_3 .QLabel#labelzBalanceTextz { /* Available zCCBC Label */ + qproperty-alignment: 'AlignVCenter | AlignRight'; + min-width: 160px; + background-color: #333; + color: #fff; + margin-right: 5px; + padding-right: 5px; + font-weight: bold; + font-size: 14px; + /* min-height:35px; */ +} + +QWidget .QFrame#frame_3 .QLabel#labelzBalancez { /* Available zCCBC Balance */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + font-weight: bold; + color: #333; + margin-left: 0px; +} + +QWidget .QFrame#frame_3 .QLabel#labelLockedBalanceText { /* Available zCCBC Label */ + qproperty-alignment: 'AlignVCenter | AlignRight'; + min-width: 160px; + background-color: #333; + color: #fff; + margin-right: 5px; + padding-right: 5px; + font-weight: bold; + font-size: 14px; + /* min-height:35px; */ +} + +QWidget .QFrame#frame_3 .QLabel#labelLockedBalance { /* Available zCCBC Balance */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + font-weight: normal; + color: #333; + margin-left: 0px; +} + +QWidget .QFrame#frame_3 .QLabel#labelUnLockedBalanceText { /* Available zCCBC Label */ + qproperty-alignment: 'AlignVCenter | AlignRight'; + min-width: 160px; + background-color: #333; + color: #fff; + margin-right: 5px; + padding-right: 5px; + font-weight: bold; + font-size: 14px; + /* min-height:35px; */ +} + +QWidget .QFrame#frame_3 .QLabel#labelUnLockedBalance { /* Available zCCBC Balance */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + font-weight: normal; + color: #333; + margin-left: 0px; +} + +/******************************************************************************************/ +/*****************************************************************************************/ +/**************************** OVERVIEW SCREEN *******************************************/ +/***************************************************************************************/ +/**************************************************************************************/ + QWidget .QFrame#frame { /* Wallet Balance */ min-width: 490px; } @@ -914,33 +1072,84 @@ QWidget .QFrame#frame { /* Wallet Balance */ min-height: 30px; } - QWidget .QFrame#frame .QLabel#label_5 { /* CCBC Balances Label */ - qproperty-alignment: 'AlignVCenter | AlignLeft'; - min-width: 160px; - background-color: transparent; - color: #333; - font-weight: bold; - font-size: 14px; - margin-right: 5px; - padding-right: 5px; - } - QWidget .QFrame#frame .QLabel#labelWalletStatus { /* Wallet Sync Status */ - qproperty-alignment: 'AlignVCenter | AlignLeft'; - margin-left: 3px; - } - QWidget .QFrame#frame .QLabel#labelSpendable { /* Spendable Header */ - qproperty-alignment: 'AlignVCenter | AlignLeft'; - font-size: 12px; - margin-left: 18px; - } +/*************** Frame_bottom_1 section*****************/ +/********************* Masternodes *********************/ - QWidget .QFrame#frame .QLabel#labelWatchonly { /* Watch-only Header */ - qproperty-alignment: 'AlignVCenter | AlignLeft'; - font-size: 12px; - margin-left: 16px; - } +QWidget .QFrame#frameInfo { /*bottom frame 1 - info */ + background-color: #ffffff; + border-style: none; + border: 1px solid; + border-color: #d2d2d2; +} + +QWidget .QFrame#frame_bottom_1 { + border-style: solid; +} + +QWidget .QFrame#frameMnInfo { + border-style: 0px; +} + +QWidget .QFrame#frameMnInfoLevels { + border-style: 0px; + border-top: 1px solid #d2d2d2; + border-top-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #ffffff, stop:0.2 #d2d2d2, stop:0.8 #d2d2d2, stop:1 #ffffff); +} + +QWidget .QFrame#frameBlockchainInfo { + border-style: 0px; +} + +QWidget .QFrame#frameBlockchainInfoData { + border-style: 0px; + border-top: 1px solid #d2d2d2; + border-top-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #ffffff, stop:0.2 #d2d2d2, stop:0.8 #d2d2d2, stop:1 #ffffff); +} + + +QWidget .QProgressBar#graphMN { + color: #000000; + border: 0px solid; + border-color: #d2d2d2; + /* border-left:1px solid #d2d2d2; + border-radius:0px;*/ + background-color: transparent; + font-size: 12px; + text-align: center; +} + +/*******************************/ +/*Start of the Balance section*/ +/******************************/ +QWidget .QFrame#frame .QLabel#label_5 { /* CCBC Balances Label */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + min-width: 160px; + background-color: transparent; + color: #333; + font-weight: bold; + font-size: 14px; + margin-right: 5px; + padding-right: 5px; +} + +QWidget .QFrame#frame .QLabel#labelWalletStatus { /* Wallet Sync Status */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + margin-left: 3px; +} + +QWidget .QFrame#frame .QLabel#labelSpendable { /* Spendable Header */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + margin-left: 18px; +} + +QWidget .QFrame#frame .QLabel#labelWatchonly { /* Watch-only Header */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + margin-left: 16px; +} QWidget .QFrame#frame .QLabel#labelBalanceText { /* Available Balance Label */ qproperty-alignment: 'AlignVCenter | AlignRight'; @@ -962,11 +1171,11 @@ QWidget .QFrame#frame .QLabel#labelBalance { /* Available Balance */ margin-left: 0px; } - QWidget .QFrame#frame .QLabel#labelWatchAvailable { /* Watch-only Balance */ - qproperty-alignment: 'AlignVCenter | AlignLeft'; - font-size: 12px; - margin-left: 16px; - } +QWidget .QFrame#frame .QLabel#labelWatchAvailable { /* Watch-only Balance */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + margin-left: 16px; +} QWidget .QFrame#frame .QLabel#labelPendingText { /* Pending Balance Label */ qproperty-alignment: 'AlignVCenter | AlignRight'; @@ -980,17 +1189,17 @@ QWidget .QFrame#frame .QLabel#labelPendingText { /* Pending Balance Label */ min-height: 35px; } - QWidget .QFrame#frame .QLabel#labelUnconfirmed { /* Pending Balance */ - qproperty-alignment: 'AlignVCenter | AlignLeft'; - font-size: 12px; - margin-left: 0px; - } +QWidget .QFrame#frame .QLabel#labelUnconfirmed { /* Pending Balance */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + margin-left: 0px; +} - QWidget .QFrame#frame .QLabel#labelWatchPending { /* Watch-only Pending Balance */ - qproperty-alignment: 'AlignVCenter | AlignLeft'; - font-size: 12px; - margin-left: 16px; - } +QWidget .QFrame#frame .QLabel#labelWatchPending { /* Watch-only Pending Balance */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + margin-left: 16px; +} QWidget .QFrame#frame .QLabel#labelImmatureText { /* Immature Balance Label */ qproperty-alignment: 'AlignVCenter | AlignRight'; @@ -1003,41 +1212,42 @@ QWidget .QFrame#frame .QLabel#labelImmatureText { /* Immature Balance Label */ font-size: 14px; min-height: 35px; } - QWidget .QFrame#frame .QLabel#labelImmature { /* Immature Balance */ - qproperty-alignment: 'AlignVCenter | AlignLeft'; - font-size: 12px; - margin-left: 0px; - } - QWidget .QFrame#frame .QLabel#labelWatchImmature { /* Watch-only Immature Balance */ - qproperty-alignment: 'AlignVCenter | AlignLeft'; - font-size: 12px; - margin-left: 16px; - } +QWidget .QFrame#frame .QLabel#labelImmature { /* Immature Balance */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + margin-left: 0px; +} - QWidget .QFrame#frame .QLabel#labelTotalText { /* Total Balance Label */ - qproperty-alignment: 'AlignVCenter | AlignRight'; - min-width: 160px; - background-color: #333; - color: #fff; - margin-right: 5px; - padding-right: 5px; - font-weight: bold; - font-size: 14px; - min-height: 35px; - } +QWidget .QFrame#frame .QLabel#labelWatchImmature { /* Watch-only Immature Balance */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + margin-left: 16px; +} - QWidget .QFrame#frame .QLabel#labelTotal { /* Total Balance */ - qproperty-alignment: 'AlignVCenter | AlignLeft'; - font-size: 12px; - margin-left: 0px; - } +QWidget .QFrame#frame .QLabel#labelTotalText { /* Total Balance Label */ + qproperty-alignment: 'AlignVCenter | AlignRight'; + min-width: 160px; + background-color: #333; + color: #fff; + margin-right: 5px; + padding-right: 5px; + font-weight: bold; + font-size: 14px; + min-height: 35px; +} - QWidget .QFrame#frame .QLabel#labelWatchTotal { /* Watch-only Total Balance */ - qproperty-alignment: 'AlignVCenter | AlignLeft'; - font-size: 12px; - margin-left: 16px; - } +QWidget .QFrame#frame .QLabel#labelTotal { /* Total Balance */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + margin-left: 0px; +} + +QWidget .QFrame#frame .QLabel#labelWatchTotal { /* Watch-only Total Balance */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + font-size: 12px; + margin-left: 16px; +} /***************************/ /*End of the Balances Area*/ @@ -1070,11 +1280,11 @@ QWidget .QFrame#frame .QLabel#label_Needed_Collat { /* Collateral Label */ min-height: 35px; } -QWidget .QFrame#frame_4 .QLabel#labelzBalance { /* Available zCCBC Balance */ +QWidget .QFrame#frame .QLabel#label_lcolat { /* Collateral Amount */ qproperty-alignment: 'AlignVCenter | AlignLeft'; font-size: 12px; font-weight: bold; - color: #fab43b; + color: #333; margin-left: 0px; } diff --git a/src/spork.cpp b/src/spork.cpp index b9476f6..9c9ee12 100644 --- a/src/spork.cpp +++ b/src/spork.cpp @@ -87,13 +87,6 @@ void ProcessSpork(CNode* pfrom, std::string& strCommand, CDataStream& vRecv) LogPrintf("spork - new %s ID %d Time %d bestHeight %d\n", hash.ToString(), spork.nSporkID, spork.nValue, chainActive.Tip()->nHeight); - if (spork.nTimeSigned >= Params().NewSporkStart()) { - if (!sporkManager.CheckSignature(spork, true)) { - LogPrintf("%s : Invalid Signature\n", __func__); - Misbehaving(pfrom->GetId(), 100); - return; - } - } if (!sporkManager.CheckSignature(spork)) { LogPrintf("spork - invalid signature\n"); Misbehaving(pfrom->GetId(), 100); @@ -189,29 +182,17 @@ void ReprocessBlocks(int nBlocks) } } -bool CSporkManager::CheckSignature(CSporkMessage& spork, bool fCheckSigner) +bool CSporkManager::CheckSignature(CSporkMessage& spork) { //note: need to investigate why this is failing std::string strMessage = boost::lexical_cast(spork.nSporkID) + boost::lexical_cast(spork.nValue) + boost::lexical_cast(spork.nTimeSigned); CPubKey pubkeynew(ParseHex(Params().SporkKey())); std::string errorMessage = ""; - //if (obfuScationSigner.VerifyMessage(pubkeynew, spork.vchSig, strMessage, errorMessage)) { - //return true; - //} - - bool fValidWithNewKey = obfuScationSigner.VerifyMessage(pubkeynew, spork.vchSig, strMessage, errorMessage); - - if (fCheckSigner && !fValidWithNewKey) - return false; - - // See if window is open that allows for old spork key to sign messages - if (!fValidWithNewKey && GetAdjustedTime() < Params().RejectOldSporkKey()) { - CPubKey pubkeyold(ParseHex(Params().SporkKeyOld())); - return obfuScationSigner.VerifyMessage(pubkeyold, spork.vchSig, strMessage, errorMessage); - } - - return fValidWithNewKey; + if (obfuScationSigner.VerifyMessage(pubkeynew, spork.vchSig, strMessage, errorMessage)) { + return true; + } + return false; } bool CSporkManager::Sign(CSporkMessage& spork) @@ -318,7 +299,7 @@ std::string CSporkManager::GetSporkNameByID(int id) if (id == SPORK_16_ZEROCOIN_MAINTENANCE_MODE) return "SPORK_16_ZEROCOIN_MAINTENANCE_MODE"; if (id == SPORK_17_TREASURY_PAYMENT_ENFORCEMENT) return "SPORK_17_TREASURY_PAYMENT_ENFORCEMENT"; if (id == SPORK_18_REVIVE_PAYMENT_ENFORCEMENT) return "SPORK_18_REVIVE_PAYMENT_ENFORCEMENT"; - if (id == SPORK_19_NEW_PROTOCOL_ENFORCEMENT_3) return "SPORK_19_NEW_PROTOCOL_ENFORCEMENT_3"; + if (id == SPORK_19_NEW_PROTOCOL_ENFORCEMENT_3) return "SPORK_16_NEW_PROTOCOL_ENFORCEMENT_3"; return "Unknown"; } diff --git a/src/spork.h b/src/spork.h index 2bb40a4..90b6229 100644 --- a/src/spork.h +++ b/src/spork.h @@ -122,7 +122,7 @@ class CSporkManager int GetSporkIDByName(std::string strName); bool UpdateSpork(int nSporkID, int64_t nValue); bool SetPrivKey(std::string strPrivKey); - bool CheckSignature(CSporkMessage& spork, bool fCheckSigner = false); + bool CheckSignature(CSporkMessage& spork); bool Sign(CSporkMessage& spork); void Relay(CSporkMessage& msg); }; diff --git a/src/version.h b/src/version.h index 2a98838..c7886c9 100644 --- a/src/version.h +++ b/src/version.h @@ -12,7 +12,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 70007; +static const int PROTOCOL_VERSION = 70006; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; @@ -22,7 +22,7 @@ static const int GETHEADERS_VERSION = 70000; //! disconnect from peers older than this proto version static const int MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT = 70005; -static const int MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT = 70007; +static const int MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT = 70006; //! nTime field added to CAddress, starting with this version; //! if possible, avoid requesting addresses nodes older than this diff --git a/src/wallet.cpp b/src/wallet.cpp index 039c391..096723a 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -28,8 +28,8 @@ #include #include -#include #include +#include using namespace std; @@ -1304,11 +1304,11 @@ CAmount CWallet::GetZerocoinBalance(bool fMatureOnly) const } } for (auto& denom : libzerocoin::zerocoinDenomList) { - LogPrint("zero", "%s My coins for denomination %d pubcoin %s\n", __func__, denom, myZerocoinSupply.at(denom)); + LogPrint("zero","%s My coins for denomination %d pubcoin %s\n", __func__,denom, myZerocoinSupply.at(denom)); } - LogPrint("zero", "Total value of coins %d\n", nTotal); + LogPrint("zero","Total value of coins %d\n",nTotal); - if (nTotal < 0) nTotal = 0; // Sanity never hurts + if (nTotal < 0 ) nTotal = 0; // Sanity never hurts return nTotal; } @@ -1323,15 +1323,15 @@ CAmount CWallet::GetUnconfirmedZerocoinBalance() const CAmount nUnconfirmed = 0; CWalletDB walletdb(pwalletMain->strWalletFile); list listMints = walletdb.ListMintedCoins(true, false, true); - + std::map mapUnconfirmed; - for (const auto& denom : libzerocoin::zerocoinDenomList) { + for (const auto& denom : libzerocoin::zerocoinDenomList){ mapUnconfirmed.insert(make_pair(denom, 0)); } { LOCK2(cs_main, cs_wallet); - for (auto& mint : listMints) { + for (auto& mint : listMints){ if (!mint.GetHeight() || mint.GetHeight() > chainActive.Height() - Params().Zerocoin_MintRequiredConfirmations()) { libzerocoin::CoinDenomination denom = mint.GetDenomination(); nUnconfirmed += libzerocoin::ZerocoinDenominationToAmount(denom); @@ -1341,12 +1341,12 @@ CAmount CWallet::GetUnconfirmedZerocoinBalance() const } for (auto& denom : libzerocoin::zerocoinDenomList) { - LogPrint("zero", "%s My unconfirmed coins for denomination %d pubcoin %s\n", __func__, denom, mapUnconfirmed.at(denom)); + LogPrint("zero","%s My unconfirmed coins for denomination %d pubcoin %s\n", __func__,denom, mapUnconfirmed.at(denom)); } - LogPrint("zero", "Total value of unconfirmed coins %ld\n", nUnconfirmed); + LogPrint("zero","Total value of unconfirmed coins %ld\n", nUnconfirmed); - if (nUnconfirmed < 0) nUnconfirmed = 0; // Sanity never hurts + if (nUnconfirmed < 0 ) nUnconfirmed = 0; // Sanity never hurts return nUnconfirmed; } @@ -1626,15 +1626,15 @@ void CWallet::AvailableCoins(vector& vCoins, bool fOnlyConfirmed, const found = IsDenominatedAmount(pcoin->vout[i].nValue); } else if (nCoinType == ONLY_NOT10000IFMN) { found = !(fMasterNode && pcoin->vout[i].nValue == 25000 * COIN); - //found = !(fMasterNode && pcoin->vout[i].nValue == Params().MasternodeCollateralAmt()*COIN); + //found = !(fMasterNode && pcoin->vout[i].nValue == Params().MasternodeCollateralAmt()*COIN); } else if (nCoinType == ONLY_NONDENOMINATED_NOT10000IFMN) { if (IsCollateralAmount(pcoin->vout[i].nValue)) continue; // do not use collateral amounts found = !IsDenominatedAmount(pcoin->vout[i].nValue); if (found && fMasterNode) found = pcoin->vout[i].nValue != 25000 * COIN; // do not use Hot MN funds - //if (found && fMasterNode) found = pcoin->vout[i].nValue != Params().MasternodeCollateralAmt()*COIN; // do not use Hot MN funds + //if (found && fMasterNode) found = pcoin->vout[i].nValue != Params().MasternodeCollateralAmt()*COIN; // do not use Hot MN funds } else if (nCoinType == ONLY_10000) { found = pcoin->vout[i].nValue == 25000 * COIN; - //found = pcoin->vout[i].nValue == Params().MasternodeCollateralAmt()*COIN; + //found = pcoin->vout[i].nValue == Params().MasternodeCollateralAmt()*COIN; } else { found = true; } @@ -1948,7 +1948,7 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, setvout[out.i].nValue == v //make sure it's the denom we're looking for && nValueRet + out.tx->vout[out.i].nValue < nTargetValue + (0.1 * COIN) + 100 //round the amount up to .1 CCBC over - ) { + ) { CTxIn vin = CTxIn(out.tx->GetHash(), out.i); int rounds = GetInputObfuscationRounds(vin); // make sure it's actually anonymized @@ -2810,6 +2810,7 @@ string CWallet::PrepareObfuscationDenominate(int minRounds, int maxRounds) /* Select the coins we'll use + if minRounds >= 0 it means only denominated inputs are going in and coming out */ if (minRounds >= 0) { @@ -3532,7 +3533,7 @@ void CWallet::AutoZeromint() if (GetAdjustedTime() > GetSporkValue(SPORK_16_ZEROCOIN_MAINTENANCE_MODE)) return; // Wait until blockchain + masternodes are fully synced and wallet is unlocked. - if (!masternodeSync.IsSynced() || IsLocked()) { + if (!masternodeSync.IsSynced() || IsLocked()){ // Re-adjust startup time in case syncing needs a long time. nStartupTime = GetAdjustedTime(); return; @@ -3540,19 +3541,19 @@ void CWallet::AutoZeromint() // After sync wait even more to reduce load when wallet was just started int64_t nWaitTime = GetAdjustedTime() - nStartupTime; - if (nWaitTime < AUTOMINT_DELAY) { + if (nWaitTime < AUTOMINT_DELAY){ LogPrint("zero", "CWallet::AutoZeromint(): time since sync-completion or last Automint (%ld sec) < default waiting time (%ld sec). Waiting again...\n", nWaitTime, AUTOMINT_DELAY); return; } CAmount nZerocoinBalance = GetZerocoinBalance(false); //false includes both pending and mature zerocoins. Need total balance for this so nothing is overminted. - CAmount nBalance = GetUnlockedCoins(); // We only consider unlocked coins, this also excludes masternode-vins - // from being accidentally minted + CAmount nBalance = GetUnlockedCoins(); // We only consider unlocked coins, this also excludes masternode-vins + // from being accidentally minted CAmount nMintAmount = 0; CAmount nToMintAmount = 0; // zCCBC are integers > 0, so we can't mint 10% of 9 CCBC - if (nBalance < 10) { + if (nBalance < 10){ LogPrint("zero", "CWallet::AutoZeromint(): available balance (%ld) too small for minting zCCBC\n", nBalance); return; } @@ -3561,9 +3562,9 @@ void CWallet::AutoZeromint() double dPercentage = 100 * (double)nZerocoinBalance / (double)(nZerocoinBalance + nBalance); // Check if minting is actually needed - if (dPercentage >= nZeromintPercentage) { + if(dPercentage >= nZeromintPercentage){ LogPrint("zero", "CWallet::AutoZeromint() @block %ld: percentage of existing zCCBC (%lf%%) already >= configured percentage (%d%%). No minting needed...\n", - chainActive.Tip()->nHeight, dPercentage, nZeromintPercentage); + chainActive.Tip()->nHeight, dPercentage, nZeromintPercentage); return; } @@ -3578,42 +3579,42 @@ void CWallet::AutoZeromint() // possible denominations to avoid having 5000 denominations only. // If a preferred denomination is used (means nPreferredDenom != 0) do nothing until we have enough CCBC to mint this denomination - if (nPreferredDenom > 0) { + if (nPreferredDenom > 0){ if (nToMintAmount >= nPreferredDenom) - nToMintAmount = nPreferredDenom; // Enough coins => mint preferred denomination + nToMintAmount = nPreferredDenom; // Enough coins => mint preferred denomination else - nToMintAmount = 0; // Not enough coins => do nothing and wait for more coins + nToMintAmount = 0; // Not enough coins => do nothing and wait for more coins } - if (nToMintAmount >= ZQ_6666) { + if (nToMintAmount >= ZQ_6666){ nMintAmount = ZQ_6666; - } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_FIVE_THOUSAND) { + } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_FIVE_THOUSAND){ nMintAmount = libzerocoin::CoinDenomination::ZQ_FIVE_THOUSAND; - } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_ONE_THOUSAND) { + } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_ONE_THOUSAND){ nMintAmount = libzerocoin::CoinDenomination::ZQ_ONE_THOUSAND; - } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_FIVE_HUNDRED) { + } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_FIVE_HUNDRED){ nMintAmount = libzerocoin::CoinDenomination::ZQ_FIVE_HUNDRED; - } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_ONE_HUNDRED) { + } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_ONE_HUNDRED){ nMintAmount = libzerocoin::CoinDenomination::ZQ_ONE_HUNDRED; - } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_FIFTY) { + } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_FIFTY){ nMintAmount = libzerocoin::CoinDenomination::ZQ_FIFTY; - } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_TEN) { + } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_TEN){ nMintAmount = libzerocoin::CoinDenomination::ZQ_TEN; - } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_FIVE) { + } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_FIVE){ nMintAmount = libzerocoin::CoinDenomination::ZQ_FIVE; - } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_ONE) { + } else if (nToMintAmount >= libzerocoin::CoinDenomination::ZQ_ONE){ nMintAmount = libzerocoin::CoinDenomination::ZQ_ONE; } else { nMintAmount = 0; } - if (nMintAmount > 0) { - CWalletTx wtx; + if (nMintAmount > 0){ + CWalletTx wtx; vector vMints; - string strError = pwalletMain->MintZerocoin(nMintAmount * COIN, wtx, vMints); + string strError = pwalletMain->MintZerocoin(nMintAmount*COIN, wtx, vMints); // Return if something went wrong during minting - if (strError != "") { + if (strError != ""){ LogPrintf("CWallet::AutoZeromint(): auto minting failed with error: %s\n", strError); return; } @@ -3621,10 +3622,11 @@ void CWallet::AutoZeromint() nBalance = GetUnlockedCoins(); dPercentage = 100 * (double)nZerocoinBalance / (double)(nZerocoinBalance + nBalance); LogPrintf("CWallet::AutoZeromint() @ block %ld: successfully minted %ld zCCBC. Current percentage of zCCBC: %lf%%\n", - chainActive.Tip()->nHeight, nMintAmount, dPercentage); + chainActive.Tip()->nHeight, nMintAmount, dPercentage); // Re-adjust startup time to delay next Automint for 5 minutes nStartupTime = GetAdjustedTime(); - } else { + } + else { LogPrintf("CWallet::AutoZeromint(): Nothing minted because either not enough funds available or the requested denomination size (%d) is not yet reached.\n", nPreferredDenom); } } @@ -3984,7 +3986,7 @@ bool CWallet::CreateZerocoinMintTransaction(const CAmount nValue, CMutableTransa libzerocoin::PublicCoin pubCoin = newCoin.getPublicCoin(); // Validate - if (!pubCoin.validate()) { + if(!pubCoin.validate()) { strFailReason = _("failed to validate zerocoin"); return false; } @@ -4118,7 +4120,8 @@ bool CWallet::MintToTxIn(CZerocoinMint zerocoinSelected, int nSecurityLevel, con CDataStream serializedCoinSpendChecking(SER_NETWORK, PROTOCOL_VERSION); try { serializedCoinSpendChecking << spend; - } catch (...) { + } + catch (...) { receipt.SetStatus("failed to deserialize", ZCCBC_BAD_SERIALIZATION); return false; } @@ -4147,7 +4150,8 @@ bool CWallet::MintToTxIn(CZerocoinMint zerocoinSelected, int nSecurityLevel, con CZerocoinSpend zcSpend(spend.getCoinSerialNumber(), 0, zerocoinSelected.GetValue(), zerocoinSelected.GetDenomination(), nAccumulatorChecksum); zcSpend.SetMintCount(nMintsAdded); receipt.AddSpend(zcSpend); - } catch (const std::exception&) { + } + catch (const std::exception&) { receipt.SetStatus("CoinSpend: Accumulator witness does not verify", ZCCBC_INVALID_WITNESS); return false; } @@ -4157,7 +4161,7 @@ bool CWallet::MintToTxIn(CZerocoinMint zerocoinSelected, int nSecurityLevel, con return true; } -bool CWallet::CreateZerocoinSpendTransaction(CAmount nValue, int nSecurityLevel, CWalletTx& wtxNew, CReserveKey& reserveKey, CZerocoinSpendReceipt& receipt, vector& vSelectedMints, vector& vNewMints, bool fMintChange, bool fMinimizeChange, CBitcoinAddress* address) +bool CWallet::CreateZerocoinSpendTransaction(CAmount nValue, int nSecurityLevel, CWalletTx& wtxNew, CReserveKey& reserveKey, CZerocoinSpendReceipt& receipt, vector& vSelectedMints, vector& vNewMints, bool fMintChange, bool fMinimizeChange, CBitcoinAddress* address) { // Check available funds int nStatus = ZCCBC_TRX_FUNDS_PROBLEMS; @@ -4178,12 +4182,12 @@ bool CWallet::CreateZerocoinSpendTransaction(CAmount nValue, int nSecurityLevel, CWalletDB walletdb(pwalletMain->strWalletFile); list listMints; CAmount nValueSelected = 0; - int nCoinsReturned = 0; // Number of coins returned in change from function below (for debug) - int nNeededSpends = 0; // Number of spends which would be needed if selection failed + int nCoinsReturned = 0; // Number of coins returned in change from function below (for debug) + int nNeededSpends = 0; // Number of spends which would be needed if selection failed const int nMaxSpends = Params().Zerocoin_MaxSpendsPerTransaction(); // Maximum possible spends for one zCCBC transaction if (vSelectedMints.empty()) { listMints = walletdb.ListMintedCoins(true, true, true); // need to find mints to spend - if (listMints.empty()) { + if(listMints.empty()) { receipt.SetStatus("failed to find Zerocoins in in wallet.dat", nStatus); return false; } @@ -4192,13 +4196,13 @@ bool CWallet::CreateZerocoinSpendTransaction(CAmount nValue, int nSecurityLevel, double dValue = static_cast(nValue) / static_cast(COIN); bool fWholeNumber = floor(dValue) == dValue; CAmount nValueToSelect = nValue; - if (!fWholeNumber) + if(!fWholeNumber) nValueToSelect = static_cast(ceil(dValue) * COIN); // Select the zCcbc mints to use in this spend std::map DenomMap = GetMyZerocoinDistribution(); vSelectedMints = SelectMintsFromList(nValueToSelect, nValueSelected, nMaxSpends, fMinimizeChange, - nCoinsReturned, listMints, DenomMap, nNeededSpends); + nCoinsReturned, listMints, DenomMap, nNeededSpends); } else { for (const CZerocoinMint mint : vSelectedMints) nValueSelected += ZerocoinDenominationToAmount(mint.GetDenomination()); @@ -4240,10 +4244,11 @@ bool CWallet::CreateZerocoinSpendTransaction(CAmount nValue, int nSecurityLevel, return false; if (vSelectedMints.empty()) { - if (nNeededSpends > 0) { + if(nNeededSpends > 0){ // Too much spends needed, so abuse nStatus to report back the number of needed spends receipt.SetStatus("Too much spends needed", nStatus, nNeededSpends); - } else { + } + else { receipt.SetStatus("failed to select a zerocoin", nStatus); } return false; @@ -4349,7 +4354,7 @@ string CWallet::ResetMintZerocoin(bool fExtendedSearch) CWalletDB walletdb(pwalletMain->strWalletFile); list listMints = walletdb.ListMintedCoins(false, false, true); - vector vMintsToFind{std::make_move_iterator(std::begin(listMints)), std::make_move_iterator(std::end(listMints))}; + vector vMintsToFind{ std::make_move_iterator(std::begin(listMints)), std::make_move_iterator(std::end(listMints)) }; vector vMintsMissing; vector vMintsToUpdate; @@ -4609,7 +4614,7 @@ bool CWallet::SpendZerocoin(CAmount nAmount, int nSecurityLevel, CWalletTx& wtxN walletdb.WriteZerocoinMint(mint); } - receipt.SetStatus("Spend Successful", ZCCBC_SPEND_OKAY); // When we reach this point spending zCCBC was successful + receipt.SetStatus("Spend Successful", ZCCBC_SPEND_OKAY); // When we reach this point spending zCCBC was successful return true; -} \ No newline at end of file +} diff --git a/src/wallet.h b/src/wallet.h index 29be3a8..9dc7ea1 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -81,27 +81,27 @@ enum AvailableCoinsType { ONLY_DENOMINATED = 2, ONLY_NOT10000IFMN = 3, ONLY_NONDENOMINATED_NOT10000IFMN = 4, // ONLY_NONDENOMINATED and not 10000 CCBC at the same time - ONLY_10000 = 5, // find masternode outputs including locked ones (use with caution) - STAKABLE_COINS = 6 // UTXO's that are valid for staking + ONLY_10000 = 5, // find masternode outputs including locked ones (use with caution) + STAKABLE_COINS = 6 // UTXO's that are valid for staking }; // Possible states for zCCBC send enum ZerocoinSpendStatus { - ZCCBC_SPEND_OKAY = 0, // No error - ZCCBC_SPEND_ERROR = 1, // Unspecified class of errors, more details are (hopefully) in the returning text - ZCCBC_WALLET_LOCKED = 2, // Wallet was locked - ZCCBC_COMMIT_FAILED = 3, // Commit failed, reset status - ZCCBC_ERASE_SPENDS_FAILED = 4, // Erasing spends during reset failed - ZCCBC_ERASE_NEW_MINTS_FAILED = 5, // Erasing new mints during reset failed - ZCCBC_TRX_FUNDS_PROBLEMS = 6, // Everything related to available funds - ZCCBC_TRX_CREATE = 7, // Everything related to create the transaction - ZCCBC_TRX_CHANGE = 8, // Everything related to transaction change - ZCCBC_TXMINT_GENERAL = 9, // General errors in MintToTxIn - ZCCBC_INVALID_COIN = 10, // Selected mint coin is not valid - ZCCBC_FAILED_ACCUMULATOR_INITIALIZATION = 11, // Failed to initialize witness - ZCCBC_INVALID_WITNESS = 12, // Spend coin transaction did not verify - ZCCBC_BAD_SERIALIZATION = 13, // Transaction verification failed - ZCCBC_SPENT_USED_ZCCBC = 14 // Coin has already been spend + ZCCBC_SPEND_OKAY = 0, // No error + ZCCBC_SPEND_ERROR = 1, // Unspecified class of errors, more details are (hopefully) in the returning text + ZCCBC_WALLET_LOCKED = 2, // Wallet was locked + ZCCBC_COMMIT_FAILED = 3, // Commit failed, reset status + ZCCBC_ERASE_SPENDS_FAILED = 4, // Erasing spends during reset failed + ZCCBC_ERASE_NEW_MINTS_FAILED = 5, // Erasing new mints during reset failed + ZCCBC_TRX_FUNDS_PROBLEMS = 6, // Everything related to available funds + ZCCBC_TRX_CREATE = 7, // Everything related to create the transaction + ZCCBC_TRX_CHANGE = 8, // Everything related to transaction change + ZCCBC_TXMINT_GENERAL = 9, // General errors in MintToTxIn + ZCCBC_INVALID_COIN = 10, // Selected mint coin is not valid + ZCCBC_FAILED_ACCUMULATOR_INITIALIZATION = 11, // Failed to initialize witness + ZCCBC_INVALID_WITNESS = 12, // Spend coin transaction did not verify + ZCCBC_BAD_SERIALIZATION = 13, // Transaction verification failed + ZCCBC_SPENT_USED_ZCCBC = 14 // Coin has already been spend }; struct CompactTallyItem { @@ -199,7 +199,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface // Zerocoin additions bool CreateZerocoinMintTransaction(const CAmount nValue, CMutableTransaction& txNew, vector& vMints, CReserveKey* reservekey, int64_t& nFeeRet, std::string& strFailReason, const CCoinControl* coinControl = NULL, const bool isZCSpendChange = false); - bool CreateZerocoinSpendTransaction(CAmount nValue, int nSecurityLevel, CWalletTx& wtxNew, CReserveKey& reserveKey, CZerocoinSpendReceipt& receipt, vector& vSelectedMints, vector& vNewMints, bool fMintChange, bool fMinimizeChange, CBitcoinAddress* address = NULL); + bool CreateZerocoinSpendTransaction(CAmount nValue, int nSecurityLevel, CWalletTx& wtxNew, CReserveKey& reserveKey, CZerocoinSpendReceipt& receipt, vector& vSelectedMints, vector& vNewMints, bool fMintChange, bool fMinimizeChange, CBitcoinAddress* address = NULL); bool MintToTxIn(CZerocoinMint zerocoinSelected, int nSecurityLevel, const uint256& hashTxOut, CTxIn& newTxIn, CZerocoinSpendReceipt& receipt); std::string MintZerocoin(CAmount nValue, CWalletTx& wtxNew, vector& vMints, const CCoinControl* coinControl = NULL); bool SpendZerocoin(CAmount nValue, int nSecurityLevel, CWalletTx& wtxNew, CZerocoinSpendReceipt& receipt, vector& vMintsSelected, bool fMintChange, bool fMinimizeChange, CBitcoinAddress* addressTo = NULL); @@ -313,7 +313,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface { fBackupMints = fEnabled; } - + bool isMultiSendEnabled() { return fMultiSendMasternodeReward || fMultiSendStake; @@ -1125,7 +1125,7 @@ class CWalletTx : public CMerkleTx return nCredit; } - // Return sum of unlocked coins + // Return sum of unlocked coins CAmount GetLockedCredit() const { if (pwallet == 0) @@ -1478,4 +1478,4 @@ class CAccountingEntry std::vector _ssExtra; }; -#endif // BITCOIN_WALLET_H \ No newline at end of file +#endif // BITCOIN_WALLET_H