diff --git a/src/darksend.cpp b/src/darksend.cpp index 98a3c90ae22f4..8ea47b01ec125 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 */ diff --git a/src/darksend.h b/src/darksend.h index db15d8b277eab..fa6922e1d058d 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 @@ class CDarkSendEntry CTransaction collateral; std::vector vout; CTransaction txSupporting; - int64_t addedTime; + int64_t addedTime; // time in UTC milliseconds CDarkSendEntry() { @@ -133,7 +133,7 @@ class CDarksendQueue //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 @@ class CDarksendQueue return false; } + /// Get the protocol version bool GetProtocolVersion(int &protocolVersion) { CMasternode* pmn = mnodeman.Find(vin); @@ -184,6 +185,7 @@ class CDarksendQueue return false; } + /// Set the 'strSharedKey' void SetSharedKey(std::string strSharedKey); /** Sign this Darksend transaction @@ -224,9 +226,13 @@ class CDarksendBroadcastTx 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 @@ class CDarkSendSigner 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; - - int64_t lastTimeChanged; // time in UTC milliseconds - int64_t lastAutoDenomination; // Note: possibly not used TODO: Delete? - - unsigned int state; + 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; // last time the 'state' changed, in UTC milliseconds + int64_t lastAutoDenomination; // TODO; not used - Delete? + + 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 @@ class CDarksendPool } } + /// 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 @@ class CDarksendPool state = newState; } + /// Get the maximum number of transactions for the pool int GetMaxPoolTransactions() { //if we're on testnet, just use two transactions per merge