Merge #893: Cleanup

3249a63 Fix logging - CTransaction::ToString() always has `\n` at the end of a string, avoid adding empty line
ec03753 make mnw errors and ThreadCheckDarkSendPool less spammy
5b678af fix errorMessage - it should not have `\n`, let output code handle line endings instead
a81cdf7 rename `dash-darksend` thread to `dash-privatesend`
5e4f468 fix/remove outdated code
f1c9678 Break tooltip about third party urls in 2 lines
This commit is contained in:
UdjinM6 2016-06-27 19:25:22 +04:00 committed by Holger Schinzel
parent a38d983b18
commit 9764e22ed8
9 changed files with 23 additions and 31 deletions

View File

@ -242,7 +242,7 @@ void CDarksendPool::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataS
}
if (nValueIn > DARKSEND_POOL_MAX) {
LogPrintf("dsi -- more than PrivateSend pool max! %s\n", tx.ToString());
LogPrintf("dsi -- more than PrivateSend pool max! %s", tx.ToString());
errorID = ERR_MAXIMUM;
pfrom->PushMessage(NetMsgType::DSSTATUSUPDATE, sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return;
@ -250,13 +250,13 @@ void CDarksendPool::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataS
if(!missingTx){
if (nValueIn-nValueOut > nValueIn*.01) {
LogPrintf("dsi -- fees are too high! %s\n", tx.ToString());
LogPrintf("dsi -- fees are too high! %s", tx.ToString());
errorID = ERR_FEES;
pfrom->PushMessage(NetMsgType::DSSTATUSUPDATE, sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return;
}
} else {
LogPrintf("dsi -- missing input tx! %s\n", tx.ToString());
LogPrintf("dsi -- missing input tx! %s", tx.ToString());
errorID = ERR_MISSING_TX;
pfrom->PushMessage(NetMsgType::DSSTATUSUPDATE, sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return;
@ -267,7 +267,7 @@ void CDarksendPool::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataS
CValidationState validationState;
mempool.PrioritiseTransaction(tx.GetHash(), tx.GetHash().ToString(), 1000, 0.1*COIN);
if(!AcceptToMemoryPool(mempool, validationState, CTransaction(tx), false, NULL, false, true, true)) {
LogPrintf("dsi -- transaction not valid! \n");
LogPrintf("dsi -- transaction not valid! %s", tx.ToString());
errorID = ERR_INVALID_TX;
pfrom->PushMessage(NetMsgType::DSSTATUSUPDATE, sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
return;
@ -500,9 +500,6 @@ std::string CDarksendPool::GetStatus()
//
void CDarksendPool::Check()
{
if(fMasterNode) LogPrint("privatesend", "CDarksendPool::Check() - entries count %lu\n", entries.size());
//printf("CDarksendPool::Check() %d - %d - %d\n", state, anonTx.CountEntries(), GetTimeMillis()-lastTimeChanged);
if(fMasterNode) {
LogPrint("privatesend", "CDarksendPool::Check() - entries count %lu\n", entries.size());
@ -1157,12 +1154,12 @@ void CDarksendPool::SendDarksendDenominate(std::vector<CTxIn>& vin, std::vector<
LogPrint("privatesend", "CDarksendPool::SendDarksendDenominate() -- tx in %s\n", i.ToString());
}
LogPrintf("Submitting tx %s\n", tx.ToString());
LogPrintf("CDarksendPool::SendDarksendDenominate() -- Submitting tx %s", tx.ToString());
mempool.PrioritiseTransaction(tx.GetHash(), tx.GetHash().ToString(), 1000, 0.1*COIN);
TRY_LOCK(cs_main, lockMain);
if(!lockMain || !AcceptToMemoryPool(mempool, validationState, CTransaction(tx), false, NULL, false, true, true)){
LogPrintf("CDarksendPool::SendDarksendDenominate() -- transaction failed! %s \n", tx.ToString());
LogPrintf("CDarksendPool::SendDarksendDenominate() -- transaction failed! %s", tx.ToString());
UnlockCoins();
SetNull();
return;
@ -2175,7 +2172,7 @@ bool CDarkSendSigner::VerifyMessage(CPubKey pubkey, vector<unsigned char>& vchSi
}
if (pubkey2.GetID() != pubkey.GetID()) {
errorMessage = strprintf("keys don't match - input: %s, recovered: %s, message: %s, sig: %s\n",
errorMessage = strprintf("keys don't match - input: %s, recovered: %s, message: %s, sig: %s",
pubkey.GetID().ToString(), pubkey2.GetID().ToString(), strMessage,
EncodeBase64(&vchSig[0], vchSig.size()));
return false;
@ -2300,22 +2297,21 @@ void CDarksendPool::UpdatedBlockTip(const CBlockIndex *pindex)
//TODO: Rename/move to core
void ThreadCheckDarkSendPool()
{
if(fLiteMode) return; //disable all Darksend/Masternode related functionality
if(fLiteMode) return; // disable all Dash specific functionality
static bool fOneThread;
if (fOneThread)
return;
fOneThread = true;
// Make this thread recognisable as the Darksend/Masternode thread
RenameThread("dash-darksend");
// Make this thread recognisable as the PrivateSend thread
RenameThread("dash-privatesend");
unsigned int c = 0;
while (true)
{
MilliSleep(1000);
//LogPrintf("ThreadCheckDarkSendPool::check timeout\n");
// try to sync from all available nodes, one step at a time
masternodeSync.Process();

View File

@ -1886,7 +1886,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
mnpayments.UpdatedBlockTip(chainActive.Tip());
masternodeSync.UpdatedBlockTip(chainActive.Tip());
// ********************************************************* Step 11d: start dash-darksend thread
// ********************************************************* Step 11d: start dash-privatesend thread
threadGroup.create_thread(boost::bind(&ThreadCheckDarkSendPool));

View File

@ -66,7 +66,7 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
// IX supports normal scripts and unspendable scripts (used in DS collateral and Budget collateral).
// TODO: Look into other script types that are normal and can be included
if(!o.scriptPubKey.IsNormalPaymentScript() && !o.scriptPubKey.IsUnspendable()){
LogPrintf("ProcessMessageInstantX::ix - Invalid Script %s\n", tx.ToString());
LogPrintf("ProcessMessageInstantX::ix - Invalid Script %s", tx.ToString());
return;
}
}

View File

@ -234,7 +234,7 @@ void CMasternodePayments::ProcessMessage(CNode* pfrom, std::string& strCommand,
std::string strError = "";
if(!winner.IsValid(pfrom, strError)){
if(strError != "") LogPrintf("mnw - invalid message - %s\n", strError);
if(strError != "") LogPrint("mnpayments", "mnw - invalid message - %s\n", strError);
return;
}
@ -471,7 +471,7 @@ bool CMasternodePaymentWinner::IsValid(CNode* pnode, std::string& strError)
if(!pmn)
{
strError = strprintf("Unknown Masternode %s", vinMasternode.prevout.ToStringShort());
LogPrintf ("CMasternodePaymentWinner::IsValid - %s\n", strError);
LogPrint("mnpayments", "CMasternodePaymentWinner::IsValid - %s\n", strError);
mnodeman.AskForMN(pnode, vinMasternode);
return false;
}
@ -479,7 +479,7 @@ bool CMasternodePaymentWinner::IsValid(CNode* pnode, std::string& strError)
if(pmn->protocolVersion < MIN_MNW_PEER_PROTO_VERSION)
{
strError = strprintf("Masternode protocol too old %d - req %d", pmn->protocolVersion, MIN_MNW_PEER_PROTO_VERSION);
LogPrintf ("CMasternodePaymentWinner::IsValid - %s\n", strError);
LogPrint("mnpayments", "CMasternodePaymentWinner::IsValid - %s\n", strError);
return false;
}
@ -492,7 +492,7 @@ bool CMasternodePaymentWinner::IsValid(CNode* pnode, std::string& strError)
if(n > MNPAYMENTS_SIGNATURES_TOTAL*2)
{
strError = strprintf("Masternode not in the top %d (%d)", MNPAYMENTS_SIGNATURES_TOTAL, n);
LogPrintf("CMasternodePaymentWinner::IsValid - %s\n", strError);
LogPrint("mnpayments", "CMasternodePaymentWinner::IsValid - %s\n", strError);
if(masternodeSync.IsSynced()) Misbehaving(pnode->GetId(), 20);
}
return false;

View File

@ -234,9 +234,6 @@ void CMasternode::Check(bool forceCheck)
}
int64_t CMasternode::SecondsSincePayment() {
CScript pubkeyScript;
pubkeyScript = GetScriptForDestination(pubkey.GetID());
int64_t sec = (GetAdjustedTime() - GetLastPaid());
int64_t month = 60*60*24*30;
if(sec < month) return sec; //if it's less than 30 days, give seconds
@ -490,7 +487,7 @@ bool CMasternodeBroadcast::CheckInputsAndAdd(int& nDos)
if(!AcceptToMemoryPool(mempool, state, CTransaction(tx), false, NULL, false, true, true)) {
//set nDos
LogPrint("masternode", "CMasternodeBroadcast::CheckInputsAndAdd - Failed to accepted Masternode entry tx to mempool - %s\n", tx.ToString());
LogPrint("masternode", "CMasternodeBroadcast::CheckInputsAndAdd - Failed to accepted Masternode entry tx to mempool - %s", tx.ToString());
state.IsInvalid(nDos);
return false;
}

View File

@ -760,7 +760,7 @@ https://www.transifex.com/projects/p/dash/</string>
<item>
<widget class="QLabel" name="thirdPartyTxUrlsLabel">
<property name="toolTip">
<string>Third party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |.</string>
<string>Third party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items.&lt;br/&gt;%s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |.</string>
</property>
<property name="text">
<string>Third party transaction URLs</string>
@ -773,7 +773,7 @@ https://www.transifex.com/projects/p/dash/</string>
<item>
<widget class="QLineEdit" name="thirdPartyTxUrls">
<property name="toolTip">
<string>Third party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |.</string>
<string>Third party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items.&lt;br/&gt;%s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |.</string>
</property>
</widget>
</item>

View File

@ -451,7 +451,7 @@ void OverviewPage::privateSendStatus()
static int64_t nLastDSProgressBlockTime = 0;
int nBestHeight = clientModel->getNumBlocks();
// we we're processing more then 1 block per second, we'll just leave
// We are processing more then 1 block per second, we'll just leave
if(((nBestHeight - darkSendPool.cachedNumBlocks) / (GetTimeMillis() - nLastDSProgressBlockTime + 1) > 1)) return;
nLastDSProgressBlockTime = GetTimeMillis();

View File

@ -679,7 +679,6 @@ padding-bottom:8px;
}
QDialog#OptionsDialog QCheckBox {
qproperty-alignment: 'AlignVCenter';
min-height:20px;
}

View File

@ -642,9 +642,9 @@ void SendCoinsDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn
msgParams.second = CClientUIInterface::MSG_ERROR;
break;
case WalletModel::AnonymizeOnlyUnlocked:
QMessageBox::warning(this, tr("Send Coins"),
tr("Error: The wallet was unlocked only to anonymize coins."),
QMessageBox::Ok, QMessageBox::Ok);
msgParams.first = tr("Transaction creation failed!") + " " + tr("The wallet was unlocked only to anonymize coins."),
msgParams.second = CClientUIInterface::MSG_ERROR;
break;
case WalletModel::AbsurdFee:
msgParams.first = tr("A fee higher than %1 is considered an absurdly high fee.").arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), maxTxFee));
break;