diff --git a/src/darksend.cpp b/src/darksend.cpp index 98a3c90ae..a226c0f2c 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -40,7 +40,7 @@ CActiveMasternode activeMasternode; int RequestedMasterNodeList = 0; /* *** BEGIN DARKSEND MAGIC - DARKCOIN ********** - Copyright 2014-2015, Darkcoin Developers + Copyright (c) 2014-2015, Darkcoin Developers eduffield - evan@darkcoin.io udjinm6 - udjinm6@darkcoin.io */ @@ -1103,7 +1103,7 @@ void CDarksendPool::CheckForCompleteQueue(){ // which is the active state right before merging the transaction // if(state == POOL_STATUS_QUEUE && sessionUsers == GetMaxPoolTransactions()) { - printf("Q ready"); + LogPrintf("Q ready"); UpdateState(POOL_STATUS_ACCEPTING_ENTRIES); if(strMasternodeSharedKey == ""){ @@ -1433,7 +1433,7 @@ bool CDarksendPool::StatusUpdate(int newState, int newEntriesCount, int newAccep sessionFoundMasternode = true; //wait for other users. Masternode will report when ready UpdateState(POOL_STATUS_QUEUE); - printf("Updated 1\n"); + LogPrintf("Updated 1\n"); } else if (newAccepted == 0 && sessionID == 0 && !sessionFoundMasternode) { LogPrintf("CDarksendPool::StatusUpdate - entry not accepted by Masternode \n"); UnlockCoins(); @@ -2070,7 +2070,7 @@ bool CDarksendPool::IsCompatibleWithSession(int64_t nDenom, CTransaction txColla } UpdateState(POOL_STATUS_QUEUE); - printf("Updated 2\n"); + LogPrintf("Updated 2\n"); vecSessionCollateral.push_back(txCollateral); return true; } diff --git a/src/darksend.h b/src/darksend.h index db15d8b27..fa6922e1d 100644 --- a/src/darksend.h +++ b/src/darksend.h @@ -62,7 +62,7 @@ int GetInputDarksendRounds(CTxIn in, int rounds=0); class CTxDSIn : public CTxIn { public: - bool fHasSig; + bool fHasSig; // flag to indicate if signed CTxDSIn(const CTxIn& in) { @@ -86,7 +86,7 @@ public: CTransaction collateral; std::vector vout; CTransaction txSupporting; - int64_t addedTime; + int64_t addedTime; // time in UTC milliseconds CDarkSendEntry() { @@ -133,7 +133,7 @@ public: //information used for the anonymous relay system int nBlockHeight; std::vector vchRelaySig; - std::string strSharedKey; + std::string strSharedKey; // shared key CDarksendQueue() { @@ -173,6 +173,7 @@ public: return false; } + /// Get the protocol version bool GetProtocolVersion(int &protocolVersion) { CMasternode* pmn = mnodeman.Find(vin); @@ -184,6 +185,7 @@ public: return false; } + /// Set the 'strSharedKey' void SetSharedKey(std::string strSharedKey); /** Sign this Darksend transaction @@ -224,9 +226,13 @@ public: class CDarkSendSigner { public: + /// Is the inputs associated with this public key? (and there is 1000 DRK - checking if valid masternode) bool IsVinAssociatedWithPubkey(CTxIn& vin, CPubKey& pubkey); + /// Set the private/public key values, returns true if successful bool SetKey(std::string strSecret, std::string& errorMessage, CKey& key, CPubKey& pubkey); + /// Sign the message, returns true if successful bool SignMessage(std::string strMessage, std::string& errorMessage, std::vector& vchSig, CKey key); + /// Verify the message, returns true if succcessful bool VerifyMessage(CPubKey pubkey, std::vector& vchSig, std::string strMessage, std::string& errorMessage); }; @@ -235,18 +241,22 @@ public: class CDSAnonTx { public: - std::vector vin; - std::vector vout; + std::vector vin; // collection of inputs + std::vector vout; // collection of outputs + /// Is the transaction valid? (TODO: not defined - remove? or code?) bool IsTransactionValid(); + /// Add an output bool AddOutput(const CTxOut out); + /// Add an input bool AddInput(const CTxIn in); - /// Add Signature bool AddSig(const CTxIn in); + /// Count the number of entries in the transaction int CountEntries() {return (int)vin.size() + (int)vout.size();} }; +/// TODO: not defined - remove? void ConnectToDarkSendMasterNodeWinner(); @@ -256,21 +266,17 @@ class CDarksendPool { public: - // clients entries - std::vector myEntries; - // Masternode entries - std::vector entries; - // the finalized transaction ready for signing - CTransaction finalTransaction; - // anonymous inputs/outputs - CDSAnonTx anonTx; - bool fSubmitAnonymousFailed; - int nCountAttempts; + std::vector myEntries; // clients entries + std::vector entries; // Masternode entries + CTransaction finalTransaction; // the finalized transaction ready for signing + CDSAnonTx anonTx; // anonymous inputs/outputs + bool fSubmitAnonymousFailed; // initally false, will change to true if when attempts > 5 + int nCountAttempts; // number of submitted attempts - int64_t lastTimeChanged; // time in UTC milliseconds - int64_t lastAutoDenomination; // Note: possibly not used TODO: Delete? + int64_t lastTimeChanged; // last time the 'state' changed, in UTC milliseconds + int64_t lastAutoDenomination; // TODO; not used - Delete? - unsigned int state; + unsigned int state; // should be one of the POOL_STATUS_XXX values unsigned int entriesCount; unsigned int lastEntryAccepted; unsigned int countEntriesAccepted; @@ -390,21 +396,25 @@ public: } } + /// Get the time the last entry was accepted (time in UTC milliseconds) int GetLastEntryAccepted() const { return lastEntryAccepted; } + /// Get the count of the accepted entries int GetCountEntriesAccepted() const { return countEntriesAccepted; } + /// Get the client's transaction count int GetMyTransactionCount() const { return myEntries.size(); } + // Set the 'state' value, with some logging and capturing when the state changed void UpdateState(unsigned int newState) { if (fMasterNode && (newState == POOL_STATUS_ERROR || newState == POOL_STATUS_SUCCESS)){ @@ -422,6 +432,7 @@ public: state = newState; } + /// Get the maximum number of transactions for the pool int GetMaxPoolTransactions() { //if we're on testnet, just use two transactions per merge diff --git a/src/init.cpp b/src/init.cpp index 13d9e9a62..f8bf4113b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1152,14 +1152,14 @@ bool AppInit2(boost::thread_group& threadGroup) //CAddress addr; //ConnectNode(addr, strNode.c_str(), true); - uiInterface.InitMessage(_("Loading masternode list...")); + uiInterface.InitMessage(_("Loading masternode cache...")); CMasternodeDB mndb; CMasternodeDB::ReadResult readResult = mndb.Read(mnodeman); if (readResult == CMasternodeDB::FileError) - LogPrintf("Missing masternode list file - masternodes.dat, will try to recreate\n"); + LogPrintf("Missing masternode cache file - mncache.dat, will try to recreate\n"); else if (readResult != CMasternodeDB::Ok) - LogPrintf("Masternode list file masternodes.dat has invalid format\n"); + LogPrintf("Masternode cache file mncache.dat has invalid format\n"); fMasterNode = GetBoolArg("-masternode", false); if(fMasterNode) { diff --git a/src/instantx.cpp b/src/instantx.cpp index 8a5525c96..0c0538e26 100644 --- a/src/instantx.cpp +++ b/src/instantx.cpp @@ -59,7 +59,7 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream& BOOST_FOREACH(const CTxOut o, tx.vout){ if(!o.scriptPubKey.IsNormalPaymentScript()){ - printf ("ProcessMessageInstantX::txlreq - Invalid Script %s\n", tx.ToString().c_str()); + LogPrintf("ProcessMessageInstantX::txlreq - Invalid Script %s\n", tx.ToString().c_str()); return; } } diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index 26da864c3..c83f83b33 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -30,7 +30,7 @@ struct CompareValueOnly CMasternodeDB::CMasternodeDB() { - pathMN = GetDataDir() / "masternodes.dat"; + pathMN = GetDataDir() / "mncache.dat"; } bool CMasternodeDB::Write(const CMasternodeMan& mnodemanToSave) @@ -60,7 +60,7 @@ bool CMasternodeDB::Write(const CMasternodeMan& mnodemanToSave) FileCommit(fileout); fileout.fclose(); - LogPrintf("Written info to masternodes.dat %dms\n", GetTimeMillis() - nStart); + LogPrintf("Written info to mncache.dat %dms\n", GetTimeMillis() - nStart); LogPrintf(" %s\n", mnodemanToSave.ToString()); return true; @@ -131,7 +131,7 @@ CMasternodeDB::ReadResult CMasternodeDB::Read(CMasternodeMan& mnodemanToLoad) } mnodemanToLoad.CheckAndRemove(); // clean out expired - LogPrintf("Loaded info from masternodes.dat %dms\n", GetTimeMillis() - nStart); + LogPrintf("Loaded info from mncache.dat %dms\n", GetTimeMillis() - nStart); LogPrintf(" %s\n", mnodemanToLoad.ToString()); return Ok; @@ -144,17 +144,17 @@ void DumpMasternodes() CMasternodeDB mndb; CMasternodeMan tempMnodeman; - LogPrintf("Verifying masternodes.dat format...\n"); + LogPrintf("Verifying mncache.dat format...\n"); CMasternodeDB::ReadResult readResult = mndb.Read(tempMnodeman); // there was an error and it was not an error on file openning => do not proceed if (readResult == CMasternodeDB::FileError) - LogPrintf("Missing masternode list file - masternodes.dat, will try to recreate\n"); + LogPrintf("Missing masternode cache file - mncache.dat, will try to recreate\n"); else if (readResult != CMasternodeDB::Ok) { - LogPrintf("Masternode list file masternodes.dat has invalid format\n"); + LogPrintf("Masternode cache file mncache.dat has invalid format\n"); return; } - LogPrintf("Writting info to masternodes.dat...\n"); + LogPrintf("Writting info to mncache.dat...\n"); mndb.Write(mnodeman); LogPrintf("Masternode dump finished %dms\n", GetTimeMillis() - nStart); diff --git a/src/masternodeman.h b/src/masternodeman.h index 9643d3776..ea3430cdc 100644 --- a/src/masternodeman.h +++ b/src/masternodeman.h @@ -26,7 +26,7 @@ class CMasternodeMan; extern CMasternodeMan mnodeman; void DumpMasternodes(); -/** Access to the MN database (masternodes.dat) +/** Access to the MN database (mncache.dat) */ class CMasternodeDB { diff --git a/src/qt/darkcoinstrings.cpp b/src/qt/darkcoinstrings.cpp index d765ff585..52c953b76 100644 --- a/src/qt/darkcoinstrings.cpp +++ b/src/qt/darkcoinstrings.cpp @@ -276,7 +276,7 @@ QT_TRANSLATE_NOOP("darkcoin-core", "List commands"), QT_TRANSLATE_NOOP("darkcoin-core", "Listen for connections on (default: 9999 or testnet: 19999)"), QT_TRANSLATE_NOOP("darkcoin-core", "Loading addresses..."), QT_TRANSLATE_NOOP("darkcoin-core", "Loading block index..."), -QT_TRANSLATE_NOOP("darkcoin-core", "Loading masternode list..."), +QT_TRANSLATE_NOOP("darkcoin-core", "Loading masternode cache..."), QT_TRANSLATE_NOOP("darkcoin-core", "Loading wallet... (%3.2f %%)"), QT_TRANSLATE_NOOP("darkcoin-core", "Loading wallet..."), QT_TRANSLATE_NOOP("darkcoin-core", "Log transaction priority and fee per kB when mining blocks (default: 0)"), diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index e1e1f40a3..8f886a356 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -391,15 +391,15 @@ void OverviewPage::darkSendStatus() } } else { if(showingDarkSendMessage % 70 <= 40) convert << tr("Submitted following entries to masternode:").toStdString() << " " << entries << "/" << darkSendPool.GetMaxPoolTransactions(); - else if(showingDarkSendMessage % 70 <= 50) convert << tr("Submitted to masternode, Waiting for more entries").toStdString() << " (" << entries << "/" << darkSendPool.GetMaxPoolTransactions() << " ) ."; - else if(showingDarkSendMessage % 70 <= 60) convert << tr("Submitted to masternode, Waiting for more entries").toStdString() << " (" << entries << "/" << darkSendPool.GetMaxPoolTransactions() << " ) .."; - else if(showingDarkSendMessage % 70 <= 70) convert << tr("Submitted to masternode, Waiting for more entries").toStdString() << " (" << entries << "/" << darkSendPool.GetMaxPoolTransactions() << " ) ..."; + else if(showingDarkSendMessage % 70 <= 50) convert << tr("Submitted to masternode, waiting for more entries").toStdString() << " (" << entries << "/" << darkSendPool.GetMaxPoolTransactions() << " ) ."; + else if(showingDarkSendMessage % 70 <= 60) convert << tr("Submitted to masternode, waiting for more entries").toStdString() << " (" << entries << "/" << darkSendPool.GetMaxPoolTransactions() << " ) .."; + else if(showingDarkSendMessage % 70 <= 70) convert << tr("Submitted to masternode, waiting for more entries").toStdString() << " (" << entries << "/" << darkSendPool.GetMaxPoolTransactions() << " ) ..."; } } else if(state == POOL_STATUS_SIGNING) { if(showingDarkSendMessage % 70 <= 10) convert << tr("Found enough users, signing ...").toStdString(); - else if(showingDarkSendMessage % 70 <= 20) convert << tr("Found enough users, signing ( waiting. )").toStdString(); - else if(showingDarkSendMessage % 70 <= 30) convert << tr("Found enough users, signing ( waiting.. )").toStdString(); - else if(showingDarkSendMessage % 70 <= 40) convert << tr("Found enough users, signing ( waiting... )").toStdString(); + else if(showingDarkSendMessage % 70 <= 20) convert << tr("Found enough users, signing ( waiting").toStdString() << ". )"; + else if(showingDarkSendMessage % 70 <= 30) convert << tr("Found enough users, signing ( waiting").toStdString() << ".. )"; + else if(showingDarkSendMessage % 70 <= 40) convert << tr("Found enough users, signing ( waiting").toStdString() << "... )"; } else if(state == POOL_STATUS_TRANSMISSION) { convert << tr("Transmitting final transaction.").toStdString(); } else if (state == POOL_STATUS_IDLE) { @@ -411,9 +411,9 @@ void OverviewPage::darkSendStatus() } else if(state == POOL_STATUS_SUCCESS) { convert << tr("Darksend request complete:").toStdString() << " " << darkSendPool.lastMessage; } else if(state == POOL_STATUS_QUEUE) { - if(showingDarkSendMessage % 70 <= 50) convert << tr("Submitted to masternode, waiting in queue .").toStdString(); - else if(showingDarkSendMessage % 70 <= 60) convert << tr("Submitted to masternode, waiting in queue ..").toStdString(); - else if(showingDarkSendMessage % 70 <= 70) convert << tr("Submitted to masternode, waiting in queue ...").toStdString(); + if(showingDarkSendMessage % 70 <= 50) convert << tr("Submitted to masternode, waiting in queue").toStdString() << " ."; + else if(showingDarkSendMessage % 70 <= 60) convert << tr("Submitted to masternode, waiting in queue").toStdString() << " .."; + else if(showingDarkSendMessage % 70 <= 70) convert << tr("Submitted to masternode, waiting in queue").toStdString() << " ..."; } else { convert << tr("Unknown state:").toStdString() << " id = " << state; } diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 4a666564e..608156c0b 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -1565,7 +1565,7 @@ Value walletpassphrase(const Array& params, bool fHelp) { if (pwalletMain->IsCrypted() && (fHelp || params.size() < 2 || params.size() > 3)) throw runtime_error( - "walletpassphrase \"passphrase\" timeout ( anonymizeonly )>\n" + "walletpassphrase \"passphrase\" timeout ( anonymizeonly )\n" "\nStores the wallet decryption key in memory for 'timeout' seconds.\n" "This is needed prior to performing transactions related to private keys such as sending darkcoins\n" "\nArguments:\n"