Merge pull request #231 from mkinney/v11.2-comments

V0.11.2.x comments
This commit is contained in:
evan82 2015-03-06 07:04:44 -07:00
commit 9f124d56b6
2 changed files with 31 additions and 20 deletions

View File

@ -40,7 +40,7 @@ CActiveMasternode activeMasternode;
int RequestedMasterNodeList = 0; int RequestedMasterNodeList = 0;
/* *** BEGIN DARKSEND MAGIC - DARKCOIN ********** /* *** BEGIN DARKSEND MAGIC - DARKCOIN **********
Copyright 2014-2015, Darkcoin Developers Copyright (c) 2014-2015, Darkcoin Developers
eduffield - evan@darkcoin.io eduffield - evan@darkcoin.io
udjinm6 - udjinm6@darkcoin.io udjinm6 - udjinm6@darkcoin.io
*/ */

View File

@ -62,7 +62,7 @@ int GetInputDarksendRounds(CTxIn in, int rounds=0);
class CTxDSIn : public CTxIn class CTxDSIn : public CTxIn
{ {
public: public:
bool fHasSig; bool fHasSig; // flag to indicate if signed
CTxDSIn(const CTxIn& in) CTxDSIn(const CTxIn& in)
{ {
@ -86,7 +86,7 @@ public:
CTransaction collateral; CTransaction collateral;
std::vector<CTxOut> vout; std::vector<CTxOut> vout;
CTransaction txSupporting; CTransaction txSupporting;
int64_t addedTime; int64_t addedTime; // time in UTC milliseconds
CDarkSendEntry() CDarkSendEntry()
{ {
@ -133,7 +133,7 @@ public:
//information used for the anonymous relay system //information used for the anonymous relay system
int nBlockHeight; int nBlockHeight;
std::vector<unsigned char> vchRelaySig; std::vector<unsigned char> vchRelaySig;
std::string strSharedKey; std::string strSharedKey; // shared key
CDarksendQueue() CDarksendQueue()
{ {
@ -173,6 +173,7 @@ public:
return false; return false;
} }
/// Get the protocol version
bool GetProtocolVersion(int &protocolVersion) bool GetProtocolVersion(int &protocolVersion)
{ {
CMasternode* pmn = mnodeman.Find(vin); CMasternode* pmn = mnodeman.Find(vin);
@ -184,6 +185,7 @@ public:
return false; return false;
} }
/// Set the 'strSharedKey'
void SetSharedKey(std::string strSharedKey); void SetSharedKey(std::string strSharedKey);
/** Sign this Darksend transaction /** Sign this Darksend transaction
@ -224,9 +226,13 @@ public:
class CDarkSendSigner class CDarkSendSigner
{ {
public: public:
/// Is the inputs associated with this public key? (and there is 1000 DRK - checking if valid masternode)
bool IsVinAssociatedWithPubkey(CTxIn& vin, CPubKey& pubkey); 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); 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<unsigned char>& vchSig, CKey key); bool SignMessage(std::string strMessage, std::string& errorMessage, std::vector<unsigned char>& vchSig, CKey key);
/// Verify the message, returns true if succcessful
bool VerifyMessage(CPubKey pubkey, std::vector<unsigned char>& vchSig, std::string strMessage, std::string& errorMessage); bool VerifyMessage(CPubKey pubkey, std::vector<unsigned char>& vchSig, std::string strMessage, std::string& errorMessage);
}; };
@ -235,18 +241,22 @@ public:
class CDSAnonTx class CDSAnonTx
{ {
public: public:
std::vector<CTxDSIn> vin; std::vector<CTxDSIn> vin; // collection of inputs
std::vector<CTxOut> vout; std::vector<CTxOut> vout; // collection of outputs
/// Is the transaction valid? (TODO: not defined - remove? or code?)
bool IsTransactionValid(); bool IsTransactionValid();
/// Add an output
bool AddOutput(const CTxOut out); bool AddOutput(const CTxOut out);
/// Add an input
bool AddInput(const CTxIn in); bool AddInput(const CTxIn in);
/// Add Signature /// Add Signature
bool AddSig(const CTxIn in); bool AddSig(const CTxIn in);
/// Count the number of entries in the transaction
int CountEntries() {return (int)vin.size() + (int)vout.size();} int CountEntries() {return (int)vin.size() + (int)vout.size();}
}; };
/// TODO: not defined - remove?
void ConnectToDarkSendMasterNodeWinner(); void ConnectToDarkSendMasterNodeWinner();
@ -256,21 +266,17 @@ class CDarksendPool
{ {
public: public:
// clients entries std::vector<CDarkSendEntry> myEntries; // clients entries
std::vector<CDarkSendEntry> myEntries; std::vector<CDarkSendEntry> entries; // Masternode entries
// Masternode entries CTransaction finalTransaction; // the finalized transaction ready for signing
std::vector<CDarkSendEntry> entries; CDSAnonTx anonTx; // anonymous inputs/outputs
// the finalized transaction ready for signing bool fSubmitAnonymousFailed; // initally false, will change to true if when attempts > 5
CTransaction finalTransaction; int nCountAttempts; // number of submitted attempts
// anonymous inputs/outputs
CDSAnonTx anonTx;
bool fSubmitAnonymousFailed;
int nCountAttempts;
int64_t lastTimeChanged; // time in UTC milliseconds int64_t lastTimeChanged; // last time the 'state' changed, in UTC milliseconds
int64_t lastAutoDenomination; // Note: possibly not used TODO: Delete? 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 entriesCount;
unsigned int lastEntryAccepted; unsigned int lastEntryAccepted;
unsigned int countEntriesAccepted; unsigned int countEntriesAccepted;
@ -390,21 +396,25 @@ public:
} }
} }
/// Get the time the last entry was accepted (time in UTC milliseconds)
int GetLastEntryAccepted() const int GetLastEntryAccepted() const
{ {
return lastEntryAccepted; return lastEntryAccepted;
} }
/// Get the count of the accepted entries
int GetCountEntriesAccepted() const int GetCountEntriesAccepted() const
{ {
return countEntriesAccepted; return countEntriesAccepted;
} }
/// Get the client's transaction count
int GetMyTransactionCount() const int GetMyTransactionCount() const
{ {
return myEntries.size(); return myEntries.size();
} }
// Set the 'state' value, with some logging and capturing when the state changed
void UpdateState(unsigned int newState) void UpdateState(unsigned int newState)
{ {
if (fMasterNode && (newState == POOL_STATUS_ERROR || newState == POOL_STATUS_SUCCESS)){ if (fMasterNode && (newState == POOL_STATUS_ERROR || newState == POOL_STATUS_SUCCESS)){
@ -422,6 +432,7 @@ public:
state = newState; state = newState;
} }
/// Get the maximum number of transactions for the pool
int GetMaxPoolTransactions() int GetMaxPoolTransactions()
{ {
//if we're on testnet, just use two transactions per merge //if we're on testnet, just use two transactions per merge