Merge pull request #316 from UdjinM6/v0.12.0.x_mn_replies

V0.12.0.x Fix translations(mn replies /protobump/ + DS progress)
This commit is contained in:
UdjinM6 2015-04-20 17:18:48 +03:00
commit 854a1be027
4 changed files with 163 additions and 120 deletions

View File

@ -53,18 +53,20 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand
if (strCommand == "dsa") { //Darksend Accept Into Pool if (strCommand == "dsa") { //Darksend Accept Into Pool
int errorID;
if (pfrom->nVersion < MIN_POOL_PEER_PROTO_VERSION) { if (pfrom->nVersion < MIN_POOL_PEER_PROTO_VERSION) {
std::string strError = _("Incompatible version."); errorID = ERR_VERSION;
LogPrintf("dsa -- incompatible version! \n"); LogPrintf("dsa -- incompatible version! \n");
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, strError); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return; return;
} }
if(!fMasterNode){ if(!fMasterNode){
std::string strError = _("This is not a Masternode."); errorID = ERR_NOT_A_MN;
LogPrintf("dsa -- not a Masternode! \n"); LogPrintf("dsa -- not a Masternode! \n");
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, strError); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return; return;
} }
@ -73,12 +75,11 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand
CTransaction txCollateral; CTransaction txCollateral;
vRecv >> nDenom >> txCollateral; vRecv >> nDenom >> txCollateral;
std::string error = "";
CMasternode* pmn = mnodeman.Find(activeMasternode.vin); CMasternode* pmn = mnodeman.Find(activeMasternode.vin);
if(pmn == NULL) if(pmn == NULL)
{ {
std::string strError = _("Not in the Masternode list."); errorID = ERR_MN_LIST;
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, strError); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return; return;
} }
@ -86,20 +87,20 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand
if(pmn->nLastDsq != 0 && if(pmn->nLastDsq != 0 &&
pmn->nLastDsq + mnodeman.CountMasternodesAboveProtocol(MIN_POOL_PEER_PROTO_VERSION)/5 > mnodeman.nDsqCount){ pmn->nLastDsq + mnodeman.CountMasternodesAboveProtocol(MIN_POOL_PEER_PROTO_VERSION)/5 > mnodeman.nDsqCount){
LogPrintf("dsa -- last dsq too recent, must wait. %s \n", pfrom->addr.ToString().c_str()); LogPrintf("dsa -- last dsq too recent, must wait. %s \n", pfrom->addr.ToString().c_str());
std::string strError = _("Last Darksend was too recent."); errorID = ERR_RECENT;
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, strError); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return; return;
} }
} }
if(!IsCompatibleWithSession(nDenom, txCollateral, error)) if(!IsCompatibleWithSession(nDenom, txCollateral, errorID))
{ {
LogPrintf("dsa -- not compatible with existing transactions! \n"); LogPrintf("dsa -- not compatible with existing transactions! \n");
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, error); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return; return;
} else { } else {
LogPrintf("dsa -- is compatible, please submit! \n"); LogPrintf("dsa -- is compatible, please submit! \n");
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_ACCEPTED, error); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_ACCEPTED, errorID);
return; return;
} }
@ -158,19 +159,19 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand
} }
} else if (strCommand == "dsi") { //DarkSend vIn } else if (strCommand == "dsi") { //DarkSend vIn
std::string error = ""; int errorID = MSG_NOERR;
if (pfrom->nVersion < MIN_POOL_PEER_PROTO_VERSION) { if (pfrom->nVersion < MIN_POOL_PEER_PROTO_VERSION) {
LogPrintf("dsi -- incompatible version! \n"); LogPrintf("dsi -- incompatible version! \n");
error = _("Incompatible version."); errorID = ERR_VERSION;
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, error); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return; return;
} }
if(!fMasterNode){ if(!fMasterNode){
LogPrintf("dsi -- not a Masternode! \n"); LogPrintf("dsi -- not a Masternode! \n");
error = _("This is not a Masternode."); errorID = ERR_NOT_A_MN;
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, error); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return; return;
} }
@ -184,8 +185,8 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand
//do we have enough users in the current session? //do we have enough users in the current session?
if(!IsSessionReady()){ if(!IsSessionReady()){
LogPrintf("dsi -- session not complete! \n"); LogPrintf("dsi -- session not complete! \n");
error = _("Session not complete!"); errorID = ERR_SESSION;
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, error); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return; return;
} }
@ -193,8 +194,8 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand
if(!IsCompatibleWithEntries(out)) if(!IsCompatibleWithEntries(out))
{ {
LogPrintf("dsi -- not compatible with existing transactions! \n"); LogPrintf("dsi -- not compatible with existing transactions! \n");
error = _("Not compatible with existing transactions."); errorID = ERR_EXISTING_TX;
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, error); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return; return;
} }
@ -213,14 +214,14 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand
if(o.scriptPubKey.size() != 25){ if(o.scriptPubKey.size() != 25){
LogPrintf("dsi - non-standard pubkey detected! %s\n", o.scriptPubKey.ToString().c_str()); LogPrintf("dsi - non-standard pubkey detected! %s\n", o.scriptPubKey.ToString().c_str());
error = _("Non-standard public key detected."); errorID = ERR_NON_STANDARD_PUBKEY;
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, error); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return; return;
} }
if(!o.scriptPubKey.IsNormalPaymentScript()){ if(!o.scriptPubKey.IsNormalPaymentScript()){
LogPrintf("dsi - invalid script! %s\n", o.scriptPubKey.ToString().c_str()); LogPrintf("dsi - invalid script! %s\n", o.scriptPubKey.ToString().c_str());
error = _("Invalid script detected."); errorID = ERR_INVALID_SCRIPT;
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, error); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return; return;
} }
} }
@ -243,40 +244,40 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand
if (nValueIn > DARKSEND_POOL_MAX) { if (nValueIn > DARKSEND_POOL_MAX) {
LogPrintf("dsi -- more than Darksend pool max! %s\n", tx.ToString().c_str()); LogPrintf("dsi -- more than Darksend pool max! %s\n", tx.ToString().c_str());
error = _("Value more than Darksend pool maximum allows."); errorID = ERR_MAXIMUM;
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, error); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return; return;
} }
if(!missingTx){ if(!missingTx){
if (nValueIn-nValueOut > nValueIn*.01) { if (nValueIn-nValueOut > nValueIn*.01) {
LogPrintf("dsi -- fees are too high! %s\n", tx.ToString().c_str()); LogPrintf("dsi -- fees are too high! %s\n", tx.ToString().c_str());
error = _("Transaction fees are too high."); errorID = ERR_FEES;
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, error); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return; return;
} }
} else { } else {
LogPrintf("dsi -- missing input tx! %s\n", tx.ToString().c_str()); LogPrintf("dsi -- missing input tx! %s\n", tx.ToString().c_str());
error = _("Missing input transaction information."); errorID = ERR_MISSING_TX;
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, error); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return; return;
} }
if(!AcceptableInputs(mempool, state, CTransaction(tx), false, NULL)) { if(!AcceptableInputs(mempool, state, CTransaction(tx), false, NULL)) {
LogPrintf("dsi -- transaction not valid! \n"); LogPrintf("dsi -- transaction not valid! \n");
error = _("Transaction not valid."); errorID = ERR_INVALID_TX;
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, error); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return; return;
} }
} }
if(AddEntry(in, nAmount, txCollateral, out, error)){ if(AddEntry(in, nAmount, txCollateral, out, errorID)){
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_ACCEPTED, error); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_ACCEPTED, errorID);
Check(); Check();
RelayStatus(sessionID, GetState(), GetEntriesCount(), MASTERNODE_RESET); RelayStatus(sessionID, GetState(), GetEntriesCount(), MASTERNODE_RESET);
} else { } else {
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, error); pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
} }
} else if (strCommand == "dssu") { //Darksend status update } else if (strCommand == "dssu") { //Darksend status update
@ -294,17 +295,17 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand
int state; int state;
int entriesCount; int entriesCount;
int accepted; int accepted;
std::string error; int errorID;
vRecv >> sessionIDMessage >> state >> entriesCount >> accepted >> error; vRecv >> sessionIDMessage >> state >> entriesCount >> accepted >> errorID;
if(fDebug) LogPrintf("dssu - state: %i entriesCount: %i accepted: %i error: %s \n", state, entriesCount, accepted, error.c_str()); if(fDebug) LogPrintf("dssu - state: %i entriesCount: %i accepted: %i error: %s \n", state, entriesCount, accepted, GetMessageByID(errorID).c_str());
if((accepted != 1 && accepted != 0) && sessionID != sessionIDMessage){ if((accepted != 1 && accepted != 0) && sessionID != sessionIDMessage){
LogPrintf("dssu - message doesn't match current Darksend session %d %d\n", sessionID, sessionIDMessage); LogPrintf("dssu - message doesn't match current Darksend session %d %d\n", sessionID, sessionIDMessage);
return; return;
} }
StatusUpdate(state, entriesCount, accepted, error, sessionIDMessage); StatusUpdate(state, entriesCount, accepted, errorID, sessionIDMessage);
} else if (strCommand == "dss") { //Darksend Sign Final Tx } else if (strCommand == "dss") { //Darksend Sign Final Tx
@ -611,7 +612,7 @@ void CDarksendPool::CheckFinalTransaction()
// not much we can do in this case // not much we can do in this case
UpdateState(POOL_STATUS_ACCEPTING_ENTRIES); UpdateState(POOL_STATUS_ACCEPTING_ENTRIES);
RelayCompletedTransaction(sessionID, true, "Transaction not valid, please try again"); RelayCompletedTransaction(sessionID, true, ERR_INVALID_TX);
return; return;
} }
@ -657,7 +658,7 @@ void CDarksendPool::CheckFinalTransaction()
txNew.RelayWalletTransaction(); txNew.RelayWalletTransaction();
// Tell the clients it was successful // Tell the clients it was successful
RelayCompletedTransaction(sessionID, false, _("Transaction created successfully.")); RelayCompletedTransaction(sessionID, false, MSG_SUCCESS);
// Randomly charge clients // Randomly charge clients
ChargeRandomFees(); ChargeRandomFees();
@ -1021,13 +1022,13 @@ bool CDarksendPool::IsCollateralValid(const CTransaction& txCollateral){
// //
// Add a clients transaction to the pool // Add a clients transaction to the pool
// //
bool CDarksendPool::AddEntry(const std::vector<CTxIn>& newInput, const int64_t& nAmount, const CTransaction& txCollateral, const std::vector<CTxOut>& newOutput, std::string& error){ bool CDarksendPool::AddEntry(const std::vector<CTxIn>& newInput, const int64_t& nAmount, const CTransaction& txCollateral, const std::vector<CTxOut>& newOutput, int& errorID){
if (!fMasterNode) return false; if (!fMasterNode) return false;
BOOST_FOREACH(CTxIn in, newInput) { BOOST_FOREACH(CTxIn in, newInput) {
if (in.prevout.IsNull() || nAmount < 0) { if (in.prevout.IsNull() || nAmount < 0) {
if(fDebug) LogPrintf ("CDarksendPool::AddEntry - input not valid!\n"); if(fDebug) LogPrintf ("CDarksendPool::AddEntry - input not valid!\n");
error = _("Input is not valid."); errorID = ERR_INVALID_INPUT;
sessionUsers--; sessionUsers--;
return false; return false;
} }
@ -1035,14 +1036,14 @@ bool CDarksendPool::AddEntry(const std::vector<CTxIn>& newInput, const int64_t&
if (!IsCollateralValid(txCollateral)){ if (!IsCollateralValid(txCollateral)){
if(fDebug) LogPrintf ("CDarksendPool::AddEntry - collateral not valid!\n"); if(fDebug) LogPrintf ("CDarksendPool::AddEntry - collateral not valid!\n");
error = _("Collateral is not valid."); errorID = ERR_INVALID_COLLATERAL;
sessionUsers--; sessionUsers--;
return false; return false;
} }
if((int)entries.size() >= GetMaxPoolTransactions()){ if((int)entries.size() >= GetMaxPoolTransactions()){
if(fDebug) LogPrintf ("CDarksendPool::AddEntry - entries is full!\n"); if(fDebug) LogPrintf ("CDarksendPool::AddEntry - entries is full!\n");
error = _("Entries are full."); errorID = ERR_ENTRIES_FULL;
sessionUsers--; sessionUsers--;
return false; return false;
} }
@ -1053,7 +1054,7 @@ bool CDarksendPool::AddEntry(const std::vector<CTxIn>& newInput, const int64_t&
BOOST_FOREACH(const CTxDSIn& s, v.sev){ BOOST_FOREACH(const CTxDSIn& s, v.sev){
if((CTxIn)s == in) { if((CTxIn)s == in) {
if(fDebug) LogPrintf ("CDarksendPool::AddEntry - found in vin\n"); if(fDebug) LogPrintf ("CDarksendPool::AddEntry - found in vin\n");
error = _("Already have that input."); errorID = ERR_ALREADY_HAVE;
sessionUsers--; sessionUsers--;
return false; return false;
} }
@ -1066,7 +1067,7 @@ bool CDarksendPool::AddEntry(const std::vector<CTxIn>& newInput, const int64_t&
entries.push_back(v); entries.push_back(v);
if(fDebug) LogPrintf("CDarksendPool::AddEntry -- adding %s\n", newInput[0].ToString().c_str()); if(fDebug) LogPrintf("CDarksendPool::AddEntry -- adding %s\n", newInput[0].ToString().c_str());
error = ""; errorID = MSG_NOERR;
return true; return true;
} }
@ -1202,21 +1203,21 @@ void CDarksendPool::SendDarksendDenominate(std::vector<CTxIn>& vin, std::vector<
// 0 means transaction was not accepted // 0 means transaction was not accepted
// 1 means transaction was accepted // 1 means transaction was accepted
bool CDarksendPool::StatusUpdate(int newState, int newEntriesCount, int newAccepted, std::string& error, int newSessionID){ bool CDarksendPool::StatusUpdate(int newState, int newEntriesCount, int newAccepted, int& errorID, int newSessionID){
if(fMasterNode) return false; if(fMasterNode) return false;
if(state == POOL_STATUS_ERROR || state == POOL_STATUS_SUCCESS) return false; if(state == POOL_STATUS_ERROR || state == POOL_STATUS_SUCCESS) return false;
UpdateState(newState); UpdateState(newState);
entriesCount = newEntriesCount; entriesCount = newEntriesCount;
if(error.size() > 0) strAutoDenomResult = _("Masternode:") + " " + error; if(errorID != MSG_NOERR) strAutoDenomResult = _("Masternode:") + " " + GetMessageByID(errorID);
if(newAccepted != -1) { if(newAccepted != -1) {
lastEntryAccepted = newAccepted; lastEntryAccepted = newAccepted;
countEntriesAccepted += newAccepted; countEntriesAccepted += newAccepted;
if(newAccepted == 0){ if(newAccepted == 0){
UpdateState(POOL_STATUS_ERROR); UpdateState(POOL_STATUS_ERROR);
lastMessage = error; lastMessage = GetMessageByID(errorID);
} }
if(newAccepted == 1 && newSessionID != 0) { if(newAccepted == 1 && newSessionID != 0) {
@ -1827,7 +1828,7 @@ bool CDarksendPool::IsCompatibleWithEntries(std::vector<CTxOut>& vout)
return true; return true;
} }
bool CDarksendPool::IsCompatibleWithSession(int64_t nDenom, CTransaction txCollateral, std::string& strReason) bool CDarksendPool::IsCompatibleWithSession(int64_t nDenom, CTransaction txCollateral, int& errorID)
{ {
if(nDenom == 0) return false; if(nDenom == 0) return false;
@ -1835,7 +1836,7 @@ bool CDarksendPool::IsCompatibleWithSession(int64_t nDenom, CTransaction txColla
if (!unitTest && !IsCollateralValid(txCollateral)){ if (!unitTest && !IsCollateralValid(txCollateral)){
if(fDebug) LogPrintf ("CDarksendPool::IsCompatibleWithSession - collateral not valid!\n"); if(fDebug) LogPrintf ("CDarksendPool::IsCompatibleWithSession - collateral not valid!\n");
strReason = _("Collateral not valid."); errorID = ERR_INVALID_COLLATERAL;
return false; return false;
} }
@ -1864,14 +1865,14 @@ bool CDarksendPool::IsCompatibleWithSession(int64_t nDenom, CTransaction txColla
} }
if((state != POOL_STATUS_ACCEPTING_ENTRIES && state != POOL_STATUS_QUEUE) || sessionUsers >= GetMaxPoolTransactions()){ if((state != POOL_STATUS_ACCEPTING_ENTRIES && state != POOL_STATUS_QUEUE) || sessionUsers >= GetMaxPoolTransactions()){
if((state != POOL_STATUS_ACCEPTING_ENTRIES && state != POOL_STATUS_QUEUE)) strReason = _("Incompatible mode."); if((state != POOL_STATUS_ACCEPTING_ENTRIES && state != POOL_STATUS_QUEUE)) errorID = ERR_MODE;
if(sessionUsers >= GetMaxPoolTransactions()) strReason = _("Masternode queue is full."); if(sessionUsers >= GetMaxPoolTransactions()) errorID = ERR_QUEUE_FULL;
LogPrintf("CDarksendPool::IsCompatibleWithSession - incompatible mode, return false %d %d\n", state != POOL_STATUS_ACCEPTING_ENTRIES, sessionUsers >= GetMaxPoolTransactions()); LogPrintf("CDarksendPool::IsCompatibleWithSession - incompatible mode, return false %d %d\n", state != POOL_STATUS_ACCEPTING_ENTRIES, sessionUsers >= GetMaxPoolTransactions());
return false; return false;
} }
if(nDenom != sessionDenom) { if(nDenom != sessionDenom) {
strReason = _("No matching denominations found for mixing."); errorID = ERR_DENOM;
return false; return false;
} }
@ -2019,6 +2020,34 @@ int CDarksendPool::GetDenominationsByAmount(int64_t nAmount, int nDenomTarget){
return GetDenominations(vout1); return GetDenominations(vout1);
} }
std::string CDarksendPool::GetMessageByID(int messageID) {
switch (messageID) {
case ERR_ALREADY_HAVE: return _("Already have that input.");
case ERR_DENOM: return _("No matching denominations found for mixing.");
case ERR_ENTRIES_FULL: return _("Entries are full.");
case ERR_EXISTING_TX: return _("Not compatible with existing transactions.");
case ERR_FEES: return _("Transaction fees are too high.");
case ERR_INVALID_COLLATERAL: return _("Collateral not valid.");
case ERR_INVALID_INPUT: return _("Input is not valid.");
case ERR_INVALID_SCRIPT: return _("Invalid script detected.");
case ERR_INVALID_TX: return _("Transaction not valid.");
case ERR_MAXIMUM: return _("Value more than Darksend pool maximum allows.");
case ERR_MN_LIST: return _("Not in the Masternode list.");
case ERR_MODE: return _("Incompatible mode.");
case ERR_NON_STANDARD_PUBKEY: return _("Non-standard public key detected.");
case ERR_NOT_A_MN: return _("This is not a Masternode.");
case ERR_QUEUE_FULL: return _("Masternode queue is full.");
case ERR_RECENT: return _("Last Darksend was too recent.");
case ERR_SESSION: return _("Session not complete!");
case ERR_MISSING_TX: return _("Missing input transaction information.");
case ERR_VERSION: return _("Incompatible version.");
case MSG_SUCCESS: return _("Transaction created successfully.");
case MSG_NOERR:
default:
return "";
}
}
bool CDarkSendSigner::IsVinAssociatedWithPubkey(CTxIn& vin, CPubKey& pubkey){ bool CDarkSendSigner::IsVinAssociatedWithPubkey(CTxIn& vin, CPubKey& pubkey){
CScript payee2; CScript payee2;
payee2 = GetScriptForDestination(pubkey.GetID()); payee2 = GetScriptForDestination(pubkey.GetID());
@ -2175,18 +2204,18 @@ void CDarksendPool::RelayIn(const std::vector<CTxDSIn>& vin, const int64_t& nAmo
} }
} }
void CDarksendPool::RelayStatus(const int sessionID, const int newState, const int newEntriesCount, const int newAccepted, const std::string error) void CDarksendPool::RelayStatus(const int sessionID, const int newState, const int newEntriesCount, const int newAccepted, const int errorID)
{ {
LOCK(cs_vNodes); LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes) BOOST_FOREACH(CNode* pnode, vNodes)
pnode->PushMessage("dssu", sessionID, newState, newEntriesCount, newAccepted, error); pnode->PushMessage("dssu", sessionID, newState, newEntriesCount, newAccepted, errorID);
} }
void CDarksendPool::RelayCompletedTransaction(const int sessionID, const bool error, const std::string errorMessage) void CDarksendPool::RelayCompletedTransaction(const int sessionID, const bool error, const int errorID)
{ {
LOCK(cs_vNodes); LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes) BOOST_FOREACH(CNode* pnode, vNodes)
pnode->PushMessage("dsc", sessionID, error, errorMessage); pnode->PushMessage("dsc", sessionID, error, errorID);
} }
//TODO: Rename/move to core //TODO: Rename/move to core
@ -2265,6 +2294,3 @@ void ThreadCheckDarkSendPool()
} }
} }
} }

View File

@ -262,6 +262,29 @@ public:
class CDarksendPool class CDarksendPool
{ {
public: public:
enum messages {
ERR_ALREADY_HAVE,
ERR_DENOM,
ERR_ENTRIES_FULL,
ERR_EXISTING_TX,
ERR_FEES,
ERR_INVALID_COLLATERAL,
ERR_INVALID_INPUT,
ERR_INVALID_SCRIPT,
ERR_INVALID_TX,
ERR_MAXIMUM,
ERR_MN_LIST,
ERR_MODE,
ERR_NON_STANDARD_PUBKEY,
ERR_NOT_A_MN,
ERR_QUEUE_FULL,
ERR_RECENT,
ERR_SESSION,
ERR_MISSING_TX,
ERR_VERSION,
MSG_NOERR,
MSG_SUCCESS
};
std::vector<CDarkSendEntry> myEntries; // clients entries std::vector<CDarkSendEntry> myEntries; // clients entries
std::vector<CDarkSendEntry> entries; // Masternode entries std::vector<CDarkSendEntry> entries; // Masternode entries
@ -420,7 +443,7 @@ public:
bool IsCompatibleWithEntries(std::vector<CTxOut>& vout); bool IsCompatibleWithEntries(std::vector<CTxOut>& vout);
/// Is this amount compatible with other client in the pool? /// Is this amount compatible with other client in the pool?
bool IsCompatibleWithSession(int64_t nAmount, CTransaction txCollateral, std::string& strReason); bool IsCompatibleWithSession(int64_t nAmount, CTransaction txCollateral, int &errorID);
/// Passively run Darksend in the background according to the configuration in settings (only for QT) /// Passively run Darksend in the background according to the configuration in settings (only for QT)
bool DoAutomaticDenominating(bool fDryRun=false, bool ready=false); bool DoAutomaticDenominating(bool fDryRun=false, bool ready=false);
@ -440,7 +463,7 @@ public:
/// If the collateral is valid given by a client /// If the collateral is valid given by a client
bool IsCollateralValid(const CTransaction& txCollateral); bool IsCollateralValid(const CTransaction& txCollateral);
/// Add a clients entry to the pool /// Add a clients entry to the pool
bool AddEntry(const std::vector<CTxIn>& newInput, const int64_t& nAmount, const CTransaction& txCollateral, const std::vector<CTxOut>& newOutput, std::string& error); bool AddEntry(const std::vector<CTxIn>& newInput, const int64_t& nAmount, const CTransaction& txCollateral, const std::vector<CTxOut>& newOutput, int& errorID);
/// Add signature to a vin /// Add signature to a vin
bool AddScriptSig(const CTxIn& newVin); bool AddScriptSig(const CTxIn& newVin);
/// Check that all inputs are signed. (Are all inputs signed?) /// Check that all inputs are signed. (Are all inputs signed?)
@ -448,7 +471,7 @@ public:
/// As a client, send a transaction to a Masternode to start the denomination process /// As a client, send a transaction to a Masternode to start the denomination process
void SendDarksendDenominate(std::vector<CTxIn>& vin, std::vector<CTxOut>& vout, int64_t amount); void SendDarksendDenominate(std::vector<CTxIn>& vin, std::vector<CTxOut>& vout, int64_t amount);
/// Get Masternode updates about the progress of Darksend /// Get Masternode updates about the progress of Darksend
bool StatusUpdate(int newState, int newEntriesCount, int newAccepted, std::string& error, int newSessionID=0); bool StatusUpdate(int newState, int newEntriesCount, int newAccepted, int &errorID, int newSessionID=0);
/// As a client, check and sign the final transaction /// As a client, check and sign the final transaction
bool SignFinalTransaction(CTransaction& finalTransactionNew, CNode* node); bool SignFinalTransaction(CTransaction& finalTransactionNew, CNode* node);
@ -476,6 +499,7 @@ public:
int GetDenominationsByAmount(int64_t nAmount, int nDenomTarget=0); int GetDenominationsByAmount(int64_t nAmount, int nDenomTarget=0);
int GetDenominationsByAmounts(std::vector<int64_t>& vecAmount); int GetDenominationsByAmounts(std::vector<int64_t>& vecAmount);
std::string GetMessageByID(int messageID);
// //
// Relay Darksend Messages // Relay Darksend Messages
@ -485,8 +509,8 @@ public:
void RelaySignaturesAnon(std::vector<CTxIn>& vin); void RelaySignaturesAnon(std::vector<CTxIn>& vin);
void RelayInAnon(std::vector<CTxIn>& vin, std::vector<CTxOut>& vout); void RelayInAnon(std::vector<CTxIn>& vin, std::vector<CTxOut>& vout);
void RelayIn(const std::vector<CTxDSIn>& vin, const int64_t& nAmount, const CTransaction& txCollateral, const std::vector<CTxDSOut>& vout); void RelayIn(const std::vector<CTxDSIn>& vin, const int64_t& nAmount, const CTransaction& txCollateral, const std::vector<CTxDSOut>& vout);
void RelayStatus(const int sessionID, const int newState, const int newEntriesCount, const int newAccepted, const std::string error=""); void RelayStatus(const int sessionID, const int newState, const int newEntriesCount, const int newAccepted, const int errorID=MSG_NOERR);
void RelayCompletedTransaction(const int sessionID, const bool error, const std::string errorMessage); void RelayCompletedTransaction(const int sessionID, const bool error, const int errorID);
}; };
void ThreadCheckDarkSendPool(); void ThreadCheckDarkSendPool();

View File

@ -24,8 +24,7 @@ QT_TRANSLATE_NOOP("dash-core", ""
"If the file does not exist, create it with owner-readable-only file " "If the file does not exist, create it with owner-readable-only file "
"permissions.\n" "permissions.\n"
"It is also recommended to set alertnotify so you are notified of problems;\n" "It is also recommended to set alertnotify so you are notified of problems;\n"
"for example: alertnotify=echo %%s | mail -s \"Dash Alert\" admin@foo." "for example: alertnotify=echo %%s | mail -s \"Dash Alert\" admin@foo.com\n"),
"com\n"),
QT_TRANSLATE_NOOP("dash-core", "" QT_TRANSLATE_NOOP("dash-core", ""
"Acceptable ciphers (default: TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!" "Acceptable ciphers (default: TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!"
"3DES:@STRENGTH)"), "3DES:@STRENGTH)"),
@ -131,8 +130,7 @@ QT_TRANSLATE_NOOP("dash-core", ""
"This is a pre-release test build - use at your own risk - do not use for " "This is a pre-release test build - use at your own risk - do not use for "
"mining or merchant applications"), "mining or merchant applications"),
QT_TRANSLATE_NOOP("dash-core", "" QT_TRANSLATE_NOOP("dash-core", ""
"Unable to bind to %s on this computer. Dash Core is probably already " "Unable to bind to %s on this computer. Dash Core is probably already running."),
"running."),
QT_TRANSLATE_NOOP("dash-core", "" QT_TRANSLATE_NOOP("dash-core", ""
"Unable to locate enough Darksend denominated funds for this transaction."), "Unable to locate enough Darksend denominated funds for this transaction."),
QT_TRANSLATE_NOOP("dash-core", "" QT_TRANSLATE_NOOP("dash-core", ""
@ -188,7 +186,6 @@ QT_TRANSLATE_NOOP("dash-core", "Cannot resolve -bind address: '%s'"),
QT_TRANSLATE_NOOP("dash-core", "Cannot resolve -externalip address: '%s'"), QT_TRANSLATE_NOOP("dash-core", "Cannot resolve -externalip address: '%s'"),
QT_TRANSLATE_NOOP("dash-core", "Cannot write default address"), QT_TRANSLATE_NOOP("dash-core", "Cannot write default address"),
QT_TRANSLATE_NOOP("dash-core", "Clear list of wallet transactions (diagnostic tool; implies -rescan)"), QT_TRANSLATE_NOOP("dash-core", "Clear list of wallet transactions (diagnostic tool; implies -rescan)"),
QT_TRANSLATE_NOOP("dash-core", "Collateral is not valid."),
QT_TRANSLATE_NOOP("dash-core", "Collateral not valid."), QT_TRANSLATE_NOOP("dash-core", "Collateral not valid."),
QT_TRANSLATE_NOOP("dash-core", "Connect only to the specified node(s)"), QT_TRANSLATE_NOOP("dash-core", "Connect only to the specified node(s)"),
QT_TRANSLATE_NOOP("dash-core", "Connect through SOCKS proxy"), QT_TRANSLATE_NOOP("dash-core", "Connect through SOCKS proxy"),
@ -197,20 +194,19 @@ QT_TRANSLATE_NOOP("dash-core", "Connect to KeePassHttp on port <port> (default:
QT_TRANSLATE_NOOP("dash-core", "Connect to a node to retrieve peer addresses, and disconnect"), QT_TRANSLATE_NOOP("dash-core", "Connect to a node to retrieve peer addresses, and disconnect"),
QT_TRANSLATE_NOOP("dash-core", "Connection options:"), QT_TRANSLATE_NOOP("dash-core", "Connection options:"),
QT_TRANSLATE_NOOP("dash-core", "Corrupted block database detected"), QT_TRANSLATE_NOOP("dash-core", "Corrupted block database detected"),
QT_TRANSLATE_NOOP("dash-core", "Dash Core Daemon"),
QT_TRANSLATE_NOOP("dash-core", "Dash Core RPC client version"),
QT_TRANSLATE_NOOP("dash-core", "Darksend is disabled."), QT_TRANSLATE_NOOP("dash-core", "Darksend is disabled."),
QT_TRANSLATE_NOOP("dash-core", "Darksend options:"), QT_TRANSLATE_NOOP("dash-core", "Darksend options:"),
QT_TRANSLATE_NOOP("dash-core", "Dash Core Daemon"),
QT_TRANSLATE_NOOP("dash-core", "Dash Core RPC client version"),
QT_TRANSLATE_NOOP("dash-core", "Debugging/Testing options:"), QT_TRANSLATE_NOOP("dash-core", "Debugging/Testing options:"),
QT_TRANSLATE_NOOP("dash-core", "Disable safemode, override a real safe mode event (default: 0)"), QT_TRANSLATE_NOOP("dash-core", "Disable safemode, override a real safe mode event (default: 0)"),
QT_TRANSLATE_NOOP("dash-core", "Discover own IP address (default: 1 when listening and no -externalip)"), QT_TRANSLATE_NOOP("dash-core", "Discover own IP address (default: 1 when listening and no -externalip)"),
QT_TRANSLATE_NOOP("dash-core", "Do not load the wallet and disable wallet RPC calls"), QT_TRANSLATE_NOOP("dash-core", "Do not load the wallet and disable wallet RPC calls"),
QT_TRANSLATE_NOOP("dash-core", "Do you want to rebuild the block database now?"), QT_TRANSLATE_NOOP("dash-core", "Do you want to rebuild the block database now?"),
QT_TRANSLATE_NOOP("dash-core", "Done loading"), QT_TRANSLATE_NOOP("dash-core", "Done loading"),
QT_TRANSLATE_NOOP("dash-core", "Downgrading and trying again."),
QT_TRANSLATE_NOOP("dash-core", "Enable the client to act as a masternode (0-1, default: 0)"), QT_TRANSLATE_NOOP("dash-core", "Enable the client to act as a masternode (0-1, default: 0)"),
QT_TRANSLATE_NOOP("dash-core", "Entries are full."), QT_TRANSLATE_NOOP("dash-core", "Entries are full."),
QT_TRANSLATE_NOOP("dash-core", "Error connecting to masternode."), QT_TRANSLATE_NOOP("dash-core", "Error connecting to Masternode."),
QT_TRANSLATE_NOOP("dash-core", "Error initializing block database"), QT_TRANSLATE_NOOP("dash-core", "Error initializing block database"),
QT_TRANSLATE_NOOP("dash-core", "Error initializing wallet database environment %s!"), QT_TRANSLATE_NOOP("dash-core", "Error initializing wallet database environment %s!"),
QT_TRANSLATE_NOOP("dash-core", "Error loading block database"), QT_TRANSLATE_NOOP("dash-core", "Error loading block database"),
@ -270,7 +266,7 @@ QT_TRANSLATE_NOOP("dash-core", "Keep N dash anonymized (default: 0)"),
QT_TRANSLATE_NOOP("dash-core", "Keep at most <n> unconnectable blocks in memory (default: %u)"), QT_TRANSLATE_NOOP("dash-core", "Keep at most <n> unconnectable blocks in memory (default: %u)"),
QT_TRANSLATE_NOOP("dash-core", "Keep at most <n> unconnectable transactions in memory (default: %u)"), QT_TRANSLATE_NOOP("dash-core", "Keep at most <n> unconnectable transactions in memory (default: %u)"),
QT_TRANSLATE_NOOP("dash-core", "Last Darksend was too recent."), QT_TRANSLATE_NOOP("dash-core", "Last Darksend was too recent."),
QT_TRANSLATE_NOOP("dash-core", "Last successful darksend action was too recent."), QT_TRANSLATE_NOOP("dash-core", "Last successful Darksend action was too recent."),
QT_TRANSLATE_NOOP("dash-core", "Limit size of signature cache to <n> entries (default: 50000)"), QT_TRANSLATE_NOOP("dash-core", "Limit size of signature cache to <n> entries (default: 50000)"),
QT_TRANSLATE_NOOP("dash-core", "List commands"), QT_TRANSLATE_NOOP("dash-core", "List commands"),
QT_TRANSLATE_NOOP("dash-core", "Listen for connections on <port> (default: 9999 or testnet: 19999)"), QT_TRANSLATE_NOOP("dash-core", "Listen for connections on <port> (default: 9999 or testnet: 19999)"),
@ -288,14 +284,14 @@ QT_TRANSLATE_NOOP("dash-core", "Masternode:"),
QT_TRANSLATE_NOOP("dash-core", "Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)"), QT_TRANSLATE_NOOP("dash-core", "Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)"),
QT_TRANSLATE_NOOP("dash-core", "Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)"), QT_TRANSLATE_NOOP("dash-core", "Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)"),
QT_TRANSLATE_NOOP("dash-core", "Missing input transaction information."), QT_TRANSLATE_NOOP("dash-core", "Missing input transaction information."),
QT_TRANSLATE_NOOP("dash-core", "No compatible masternode found."), QT_TRANSLATE_NOOP("dash-core", "No Masternodes detected."),
QT_TRANSLATE_NOOP("dash-core", "No compatible Masternode found."),
QT_TRANSLATE_NOOP("dash-core", "No funds detected in need of denominating."), QT_TRANSLATE_NOOP("dash-core", "No funds detected in need of denominating."),
QT_TRANSLATE_NOOP("dash-core", "No masternodes detected."),
QT_TRANSLATE_NOOP("dash-core", "No matching denominations found for mixing."), QT_TRANSLATE_NOOP("dash-core", "No matching denominations found for mixing."),
QT_TRANSLATE_NOOP("dash-core", "Non-standard public key detected."), QT_TRANSLATE_NOOP("dash-core", "Non-standard public key detected."),
QT_TRANSLATE_NOOP("dash-core", "Not compatible with existing transactions."), QT_TRANSLATE_NOOP("dash-core", "Not compatible with existing transactions."),
QT_TRANSLATE_NOOP("dash-core", "Not enough file descriptors available."), QT_TRANSLATE_NOOP("dash-core", "Not enough file descriptors available."),
QT_TRANSLATE_NOOP("dash-core", "Not in the masternode list."), QT_TRANSLATE_NOOP("dash-core", "Not in the Masternode list."),
QT_TRANSLATE_NOOP("dash-core", "Only accept block chain matching built-in checkpoints (default: 1)"), QT_TRANSLATE_NOOP("dash-core", "Only accept block chain matching built-in checkpoints (default: 1)"),
QT_TRANSLATE_NOOP("dash-core", "Only connect to nodes in network <net> (IPv4, IPv6 or Tor)"), QT_TRANSLATE_NOOP("dash-core", "Only connect to nodes in network <net> (IPv4, IPv6 or Tor)"),
QT_TRANSLATE_NOOP("dash-core", "Options:"), QT_TRANSLATE_NOOP("dash-core", "Options:"),
@ -321,9 +317,9 @@ QT_TRANSLATE_NOOP("dash-core", "Send trace/debug info to console instead of debu
QT_TRANSLATE_NOOP("dash-core", "Server certificate file (default: server.cert)"), QT_TRANSLATE_NOOP("dash-core", "Server certificate file (default: server.cert)"),
QT_TRANSLATE_NOOP("dash-core", "Server private key (default: server.pem)"), QT_TRANSLATE_NOOP("dash-core", "Server private key (default: server.pem)"),
QT_TRANSLATE_NOOP("dash-core", "Session not complete!"), QT_TRANSLATE_NOOP("dash-core", "Session not complete!"),
QT_TRANSLATE_NOOP("dash-core", "Session timed out (30 seconds), please resubmit."), QT_TRANSLATE_NOOP("dash-core", "Session timed out, please resubmit."),
QT_TRANSLATE_NOOP("dash-core", "Set database cache size in megabytes (%d to %d, default: %d)"), QT_TRANSLATE_NOOP("dash-core", "Set database cache size in megabytes (%d to %d, default: %d)"),
QT_TRANSLATE_NOOP("dash-core", "Set key pool size to <n> (default: 100)"), QT_TRANSLATE_NOOP("dash-core", "Set key pool size to <n> (default: 1000)"),
QT_TRANSLATE_NOOP("dash-core", "Set maximum block size in bytes (default: %d)"), QT_TRANSLATE_NOOP("dash-core", "Set maximum block size in bytes (default: %d)"),
QT_TRANSLATE_NOOP("dash-core", "Set minimum block size in bytes (default: 0)"), QT_TRANSLATE_NOOP("dash-core", "Set minimum block size in bytes (default: 0)"),
QT_TRANSLATE_NOOP("dash-core", "Set the masternode private key"), QT_TRANSLATE_NOOP("dash-core", "Set the masternode private key"),
@ -347,7 +343,7 @@ QT_TRANSLATE_NOOP("dash-core", "Start Dash Core Daemon"),
QT_TRANSLATE_NOOP("dash-core", "System error: "), QT_TRANSLATE_NOOP("dash-core", "System error: "),
QT_TRANSLATE_NOOP("dash-core", "This help message"), QT_TRANSLATE_NOOP("dash-core", "This help message"),
QT_TRANSLATE_NOOP("dash-core", "This is intended for regression testing tools and app development."), QT_TRANSLATE_NOOP("dash-core", "This is intended for regression testing tools and app development."),
QT_TRANSLATE_NOOP("dash-core", "This is not a masternode."), QT_TRANSLATE_NOOP("dash-core", "This is not a Masternode."),
QT_TRANSLATE_NOOP("dash-core", "Threshold for disconnecting misbehaving peers (default: 100)"), QT_TRANSLATE_NOOP("dash-core", "Threshold for disconnecting misbehaving peers (default: 100)"),
QT_TRANSLATE_NOOP("dash-core", "To use the %s option"), QT_TRANSLATE_NOOP("dash-core", "To use the %s option"),
QT_TRANSLATE_NOOP("dash-core", "Transaction amount too small"), QT_TRANSLATE_NOOP("dash-core", "Transaction amount too small"),

View File

@ -358,10 +358,8 @@ void OverviewPage::updateDarksendProgress()
ui->darksendProgress->setValue(progress); ui->darksendProgress->setValue(progress);
std::ostringstream convert; QString strToolPip = tr("Progress: %1% (inputs have an average of %2 of %n rounds)", "", nDarksendRounds).arg(progress).arg(pwalletMain->GetAverageAnonymizedRounds());
convert << "Progress: " << progress << "%, inputs have an average of " << pwalletMain->GetAverageAnonymizedRounds() << " of " << nDarksendRounds << " rounds"; ui->darksendProgress->setToolTip(strToolPip);
QString s(convert.str().c_str());
ui->darksendProgress->setToolTip(s);
} }
@ -377,12 +375,10 @@ void OverviewPage::darkSendStatus()
updateDarksendProgress(); updateDarksendProgress();
QString strSettings(" " + tr("Rounds")); QString strSettings = BitcoinUnits::formatWithUnit(
strSettings.prepend(QString::number(nDarksendRounds)).prepend(" / "); walletModel->getOptionsModel()->getDisplayUnit(),
strSettings.prepend(BitcoinUnits::formatWithUnit( nAnonymizeDarkcoinAmount * COIN
walletModel->getOptionsModel()->getDisplayUnit(), ) + " / " + tr("%n Rounds", "", nDarksendRounds);
nAnonymizeDarkcoinAmount * COIN)
);
ui->labelAmountRounds->setText(strSettings); ui->labelAmountRounds->setText(strSettings);
} }
@ -416,60 +412,61 @@ void OverviewPage::darkSendStatus()
int accepted = darkSendPool.GetLastEntryAccepted(); int accepted = darkSendPool.GetLastEntryAccepted();
/* ** @TODO this string creation really needs some clean ups ---vertoe ** */ /* ** @TODO this string creation really needs some clean ups ---vertoe ** */
std::ostringstream convert; QString strStatus;
if(state == POOL_STATUS_IDLE) { if(chainActive.Tip()->nHeight - darkSendPool.cachedLastSuccess < darkSendPool.minBlockSpacing) {
convert << tr("Darksend is idle.").toStdString(); strStatus = QString(darkSendPool.strAutoDenomResult.c_str());
} else if(state == POOL_STATUS_IDLE) {
strStatus = tr("Darksend is idle.");
} else if(state == POOL_STATUS_ACCEPTING_ENTRIES) { } else if(state == POOL_STATUS_ACCEPTING_ENTRIES) {
if(entries == 0) { if(entries == 0) {
if(darkSendPool.strAutoDenomResult.size() == 0){ if(darkSendPool.strAutoDenomResult.size() == 0){
convert << tr("Mixing in progress...").toStdString(); strStatus = tr("Mixing in progress...");
} else { } else {
convert << darkSendPool.strAutoDenomResult; strStatus = QString(darkSendPool.strAutoDenomResult.c_str());
} }
showingDarkSendMessage = 0; showingDarkSendMessage = 0;
} else if (accepted == 1) { } else if (accepted == 1) {
convert << tr("Darksend request complete: Your transaction was accepted into the pool!").toStdString(); strStatus = tr("Darksend request complete:") + " " + tr("Your transaction was accepted into the pool!");
if(showingDarkSendMessage % 10 > 8) { if(showingDarkSendMessage % 10 > 8) {
darkSendPool.lastEntryAccepted = 0; darkSendPool.lastEntryAccepted = 0;
showingDarkSendMessage = 0; showingDarkSendMessage = 0;
} }
} else { } else {
if(showingDarkSendMessage % 70 <= 40) convert << tr("Submitted following entries to masternode:").toStdString() << " " << entries << "/" << darkSendPool.GetMaxPoolTransactions(); if(showingDarkSendMessage % 70 <= 40) strStatus = tr("Submitted following entries to masternode: %1 / %2").arg(entries).arg(darkSendPool.GetMaxPoolTransactions());
else if(showingDarkSendMessage % 70 <= 50) convert << tr("Submitted to masternode, waiting for more entries").toStdString() << " (" << entries << "/" << darkSendPool.GetMaxPoolTransactions() << " ) ."; else if(showingDarkSendMessage % 70 <= 50) strStatus = tr("Submitted to masternode, waiting for more entries ( %1 / %2 ) %3").arg(entries).arg(darkSendPool.GetMaxPoolTransactions()).arg(" .");
else if(showingDarkSendMessage % 70 <= 60) convert << tr("Submitted to masternode, waiting for more entries").toStdString() << " (" << entries << "/" << darkSendPool.GetMaxPoolTransactions() << " ) .."; else if(showingDarkSendMessage % 70 <= 60) strStatus = tr("Submitted to masternode, waiting for more entries ( %1 / %2 ) %3").arg(entries).arg(darkSendPool.GetMaxPoolTransactions()).arg(" ..");
else if(showingDarkSendMessage % 70 <= 70) convert << tr("Submitted to masternode, waiting for more entries").toStdString() << " (" << entries << "/" << darkSendPool.GetMaxPoolTransactions() << " ) ..."; else if(showingDarkSendMessage % 70 <= 70) strStatus = tr("Submitted to masternode, waiting for more entries ( %1 / %2 ) %3").arg(entries).arg(darkSendPool.GetMaxPoolTransactions()).arg(" ...");
} }
} else if(state == POOL_STATUS_SIGNING) { } else if(state == POOL_STATUS_SIGNING) {
if(showingDarkSendMessage % 70 <= 10) convert << tr("Found enough users, signing ...").toStdString(); if(showingDarkSendMessage % 70 <= 10) strStatus = tr("Found enough users, signing ...");
else if(showingDarkSendMessage % 70 <= 20) convert << tr("Found enough users, signing ( waiting").toStdString() << ". )"; else if(showingDarkSendMessage % 70 <= 20) strStatus = tr("Found enough users, signing ( waiting %1 )").arg(".");
else if(showingDarkSendMessage % 70 <= 30) convert << tr("Found enough users, signing ( waiting").toStdString() << ".. )"; else if(showingDarkSendMessage % 70 <= 30) strStatus = tr("Found enough users, signing ( waiting %1 )").arg("..");
else if(showingDarkSendMessage % 70 <= 40) convert << tr("Found enough users, signing ( waiting").toStdString() << "... )"; else if(showingDarkSendMessage % 70 <= 40) strStatus = tr("Found enough users, signing ( waiting %1 )").arg("...");
} else if(state == POOL_STATUS_TRANSMISSION) { } else if(state == POOL_STATUS_TRANSMISSION) {
convert << tr("Transmitting final transaction.").toStdString(); strStatus = tr("Transmitting final transaction.");
} else if (state == POOL_STATUS_IDLE) { } else if (state == POOL_STATUS_IDLE) {
convert << tr("Darksend is idle.").toStdString(); strStatus = tr("Darksend is idle.");
} else if (state == POOL_STATUS_FINALIZE_TRANSACTION) { } else if (state == POOL_STATUS_FINALIZE_TRANSACTION) {
convert << tr("Finalizing transaction.").toStdString(); strStatus = tr("Finalizing transaction.");
} else if(state == POOL_STATUS_ERROR) { } else if(state == POOL_STATUS_ERROR) {
convert << tr("Darksend request incomplete:").toStdString() << " " << darkSendPool.lastMessage << ". " << tr("Will retry...").toStdString(); strStatus = tr("Darksend request incomplete:") + " " + tr(darkSendPool.lastMessage.c_str()) + " " + tr("Will retry...");
} else if(state == POOL_STATUS_SUCCESS) { } else if(state == POOL_STATUS_SUCCESS) {
convert << tr("Darksend request complete:").toStdString() << " " << darkSendPool.lastMessage; strStatus = tr("Darksend request complete:") + " " + tr(darkSendPool.lastMessage.c_str());
} else if(state == POOL_STATUS_QUEUE) { } else if(state == POOL_STATUS_QUEUE) {
if(showingDarkSendMessage % 70 <= 50) convert << tr("Submitted to masternode, waiting in queue").toStdString() << " ."; if(showingDarkSendMessage % 70 <= 50) strStatus = tr("Submitted to masternode, waiting in queue %1").arg(".");
else if(showingDarkSendMessage % 70 <= 60) convert << tr("Submitted to masternode, waiting in queue").toStdString() << " .."; else if(showingDarkSendMessage % 70 <= 60) strStatus = tr("Submitted to masternode, waiting in queue %1").arg("..");
else if(showingDarkSendMessage % 70 <= 70) convert << tr("Submitted to masternode, waiting in queue").toStdString() << " ..."; else if(showingDarkSendMessage % 70 <= 70) strStatus = tr("Submitted to masternode, waiting in queue %1").arg("...");
} else { } else {
convert << tr("Unknown state:").toStdString() << " id = " << state; strStatus = tr("Unknown state: id = %1").arg(state);
} }
if(state == POOL_STATUS_ERROR || state == POOL_STATUS_SUCCESS) darkSendPool.Check(); if(state == POOL_STATUS_ERROR || state == POOL_STATUS_SUCCESS) darkSendPool.Check();
QString s(convert.str().c_str()); QString s = tr("Last Darksend message:\n") + strStatus;
s = tr("Last Darksend message:\n") + s;
if(s != ui->darksendStatus->text()) if(s != ui->darksendStatus->text())
LogPrintf("Last Darksend message: %s\n", convert.str().c_str()); LogPrintf("Last Darksend message: %s\n", strStatus.toStdString());
ui->darksendStatus->setText(s); ui->darksendStatus->setText(s);