From ad26dc9c314406034cef7684d4c9f9ec31d6347e Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 17 Jul 2014 14:08:07 +0200 Subject: [PATCH] Revert "Formatting, spelling, comment fixes." This reverts commit 7a19efe04069d9a1e251cdc94b25184f76d9d901. --- doc/release-notes.md | 2 +- src/main.cpp | 6 ++++-- src/qt/transactionrecord.h | 13 +++---------- src/qt/transactiontablemodel.cpp | 4 ++-- src/qt/walletmodel.cpp | 14 +++++++------- src/wallet.cpp | 2 +- 6 files changed, 18 insertions(+), 23 deletions(-) diff --git a/doc/release-notes.md b/doc/release-notes.md index 66059800b..31df2883c 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -83,5 +83,5 @@ Warning - Using other relay rules, a double-spender can craft his crime to resist broadcast - Miners can choose which conflicting spend to confirm, and some - miners may not confirm the first acceptable spend they see + miners may not confirmg the first acceptable spend they see diff --git a/src/main.cpp b/src/main.cpp index f3819b149..d69c2d902 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -898,6 +898,7 @@ bool RateLimitExceeded(double& dCount, int64_t& nLastTime, int64_t nLimit, unsig LOCK(csLimiter); + // Use an exponentially decaying ~10-minute window: dCount *= pow(1.0 - 1.0/600.0, (double)(nNow - nLastTime)); nLastTime = nNow; if (dCount >= nLimit*10*1000) @@ -1018,7 +1019,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa static int64_t nLastFreeTime; static int64_t nFreeLimit = GetArg("-limitfreerelay", 15); - if (RateLimitExceeded(dFreeCount, nLastFreeTime, nFreeLimit, nSize)) + if (RateLimitExceeded(dFreeCount, nLastFreeTime, nFreeLimit, nSize)) return state.DoS(0, error("AcceptToMemoryPool : free transaction rejected by rate limiter"), REJECT_INSUFFICIENTFEE, "insufficient priority"); @@ -1045,7 +1046,8 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa return true; } -static void RelayDoubleSpend(const COutPoint& outPoint, const CTransaction& doubleSpend, bool fInBlock, CBloomFilter& filter) +static void +RelayDoubleSpend(const COutPoint& outPoint, const CTransaction& doubleSpend, bool fInBlock, CBloomFilter& filter) { // Relaying double-spend attempts to our peers lets them detect when // somebody might be trying to cheat them. However, blindly relaying diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h index d3cfa77d9..e6ff4ca08 100644 --- a/src/qt/transactionrecord.h +++ b/src/qt/transactionrecord.h @@ -19,17 +19,10 @@ class TransactionStatus { public: TransactionStatus(): - countsForBalance(false), - sortKey(""), - matures_in(0), - status(Offline), - hasConflicting(false), - depth(0), - open_for(0), - cur_num_blocks(-1), + countsForBalance(false), sortKey(""), + matures_in(0), status(Offline), hasConflicting(false), depth(0), open_for(0), cur_num_blocks(-1), cur_num_conflicts(-1) - { - } + { } enum Status { Confirmed, /**< Have 6 or more confirmations (normal tx) or fully mature (mined tx) **/ diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index cf4c90c7f..6156a2ecd 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -546,9 +546,9 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const case Qt::TextAlignmentRole: return column_alignments[index.column()]; case Qt::BackgroundColorRole: - if (rec->status.hasConflicting) + if (rec->status.hasConflicting) return COLOR_HASCONFLICTING_BG; - break; + break; case Qt::ForegroundRole: if (rec->status.hasConflicting) return COLOR_HASCONFLICTING; diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 7df8812cc..3cbf35436 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -164,13 +164,13 @@ void WalletModel::checkBalanceChanged() void WalletModel::updateTransaction(const QString &hash, int status) { - if (status == CT_GOT_CONFLICT) - { - emit message(tr("Conflict Received"), - tr("WARNING: Transaction may never be confirmed. Its input was seen being spent by another transaction on the network. Wait for confirmation!"), - CClientUIInterface::MSG_WARNING); - return; - } + if (status == CT_GOT_CONFLICT) + { + emit message(tr("Conflict Received"), + tr("WARNING: Transaction may never be confirmed. Its input was seen being spent by another transaction on the network. Wait for confirmation!"), + CClientUIInterface::MSG_WARNING); + return; + } if(transactionTableModel) transactionTableModel->updateTransaction(hash, status); diff --git a/src/wallet.cpp b/src/wallet.cpp index efefb71b6..f0ab70afb 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -657,7 +657,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl bool fIsConflicting = IsConflicting(tx); if (fIsConflicting) - nConflictsReceived++; + nConflictsReceived++; if (fExisted || IsMine(tx) || IsFromMe(tx) || fIsConflicting) {