Skip to content

Commit 3015e0b

Browse files
committed
Revert "UI to alert of respend attempt affecting wallet."
This reverts commit ada5a06. Conflicts: src/qt/guiconstants.h src/wallet.h
1 parent 39d3f2c commit 3015e0b

9 files changed

+21
-87
lines changed

src/qt/guiconstants.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ static const int STATUSBAR_ICONSIZE = 16;
2323
#define COLOR_NEGATIVE QColor(255, 0, 0)
2424
/* Transaction list -- bare address (without label) */
2525
#define COLOR_BAREADDRESS QColor(140, 140, 140)
26-
/* Transaction list -- has conflicting transactions */
27-
#define COLOR_HASCONFLICTING QColor(255, 255, 255)
28-
/* Transaction list -- has conflicting transactions - background */
29-
#define COLOR_HASCONFLICTING_BG QColor(192, 0, 0)
3026

3127
/* Tooltips longer than this (in characters) are converted into rich text,
3228
so that they can be word-wrapped.

src/qt/transactionfilterproxy.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ TransactionFilterProxy::TransactionFilterProxy(QObject *parent) :
2424
typeFilter(ALL_TYPES),
2525
minAmount(0),
2626
limitRows(-1),
27-
showInactive(false)
27+
showInactive(true)
2828
{
2929
}
3030

@@ -39,7 +39,7 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &
3939
qint64 amount = llabs(index.data(TransactionTableModel::AmountRole).toLongLong());
4040
int status = index.data(TransactionTableModel::StatusRole).toInt();
4141

42-
if(!showInactive && status == TransactionStatus::Conflicted && type == TransactionRecord::Other)
42+
if(!showInactive && status == TransactionStatus::Conflicted)
4343
return false;
4444
if(!(TYPE(type) & typeFilter))
4545
return false;

src/qt/transactionrecord.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,6 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
184184
status.depth = wtx.GetDepthInMainChain();
185185
status.cur_num_blocks = chainActive.Height();
186186

187-
status.hasConflicting = false;
188-
189187
if (!IsFinalTx(wtx, chainActive.Height() + 1))
190188
{
191189
if (wtx.nLockTime < LOCKTIME_THRESHOLD)
@@ -229,7 +227,6 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
229227
if (status.depth < 0)
230228
{
231229
status.status = TransactionStatus::Conflicted;
232-
status.hasConflicting = !(wtx.GetConflicts(false).empty());
233230
}
234231
else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
235232
{
@@ -238,7 +235,6 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
238235
else if (status.depth == 0)
239236
{
240237
status.status = TransactionStatus::Unconfirmed;
241-
status.hasConflicting = !(wtx.GetConflicts(false).empty());
242238
}
243239
else if (status.depth < RecommendedNumConfirmations)
244240
{
@@ -249,13 +245,13 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
249245
status.status = TransactionStatus::Confirmed;
250246
}
251247
}
248+
252249
}
253250

254-
bool TransactionRecord::statusUpdateNeeded(int64_t nConflictsReceived)
251+
bool TransactionRecord::statusUpdateNeeded()
255252
{
256253
AssertLockHeld(cs_main);
257-
return (status.cur_num_blocks != chainActive.Height() ||
258-
status.cur_num_conflicts != nConflictsReceived);
254+
return status.cur_num_blocks != chainActive.Height();
259255
}
260256

261257
QString TransactionRecord::getTxID() const

src/qt/transactionrecord.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ class TransactionStatus
2020
public:
2121
TransactionStatus():
2222
countsForBalance(false), sortKey(""),
23-
matures_in(0), status(Offline), hasConflicting(false), depth(0), open_for(0), cur_num_blocks(-1),
24-
cur_num_conflicts(-1)
23+
matures_in(0), status(Offline), depth(0), open_for(0), cur_num_blocks(-1)
2524
{ }
2625

2726
enum Status {
@@ -52,10 +51,6 @@ class TransactionStatus
5251
/** @name Reported status
5352
@{*/
5453
Status status;
55-
56-
// Has conflicting transactions spending same prevout
57-
bool hasConflicting;
58-
5954
qint64 depth;
6055
qint64 open_for; /**< Timestamp if status==OpenUntilDate, otherwise number
6156
of additional blocks that need to be mined before
@@ -64,10 +59,6 @@ class TransactionStatus
6459

6560
/** Current number of blocks (to know whether cached status is still valid) */
6661
int cur_num_blocks;
67-
68-
/** Number of conflicts received into wallet as of last status update */
69-
int64_t cur_num_conflicts;
70-
7162
};
7263

7364
/** UI model for a transaction. A core transaction can be represented by multiple UI transactions if it has
@@ -145,7 +136,7 @@ class TransactionRecord
145136

146137
/** Return whether a status update is needed.
147138
*/
148-
bool statusUpdateNeeded(int64_t nConflictsReceived);
139+
bool statusUpdateNeeded();
149140
};
150141

151142
#endif // TRANSACTIONRECORD_H

src/qt/transactiontablemodel.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ class TransactionTablePriv
167167
parent->endRemoveRows();
168168
break;
169169
case CT_UPDATED:
170-
emit parent->dataChanged(parent->index(lowerIndex, parent->Status), parent->index(upperIndex-1, parent->Amount));
170+
// Miscellaneous updates -- nothing to do, status update will take care of this, and is only computed for
171+
// visible transactions.
171172
break;
172173
}
173174
}
@@ -188,21 +189,20 @@ class TransactionTablePriv
188189
// stuck if the core is holding the locks for a longer time - for
189190
// example, during a wallet rescan.
190191
//
191-
// If a status update is needed (blocks or conflicts came in since last check),
192-
// update the status of this transaction from the wallet. Otherwise,
192+
// If a status update is needed (blocks came in since last check),
193+
// update the status of this transaction from the wallet. Otherwise,
193194
// simply re-use the cached status.
194195
TRY_LOCK(cs_main, lockMain);
195196
if(lockMain)
196197
{
197198
TRY_LOCK(wallet->cs_wallet, lockWallet);
198-
if(lockWallet && rec->statusUpdateNeeded(wallet->nConflictsReceived))
199+
if(lockWallet && rec->statusUpdateNeeded())
199200
{
200201
std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(rec->hash);
201202

202203
if(mi != wallet->mapWallet.end())
203204
{
204205
rec->updateStatus(mi->second);
205-
rec->status.cur_num_conflicts = wallet->nConflictsReceived;
206206
}
207207
}
208208
}
@@ -368,8 +368,6 @@ QString TransactionTableModel::formatTxType(const TransactionRecord *wtx) const
368368
return tr("Payment to yourself");
369369
case TransactionRecord::Generated:
370370
return tr("Mined");
371-
case TransactionRecord::Other:
372-
return tr("Other");
373371
default:
374372
return QString();
375373
}
@@ -545,13 +543,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
545543
return formatTooltip(rec);
546544
case Qt::TextAlignmentRole:
547545
return column_alignments[index.column()];
548-
case Qt::BackgroundColorRole:
549-
if (rec->status.hasConflicting)
550-
return COLOR_HASCONFLICTING_BG;
551-
break;
552546
case Qt::ForegroundRole:
553-
if (rec->status.hasConflicting)
554-
return COLOR_HASCONFLICTING;
555547
// Non-confirmed (but not immature) as transactions are grey
556548
if(!rec->status.countsForBalance && rec->status.status != TransactionStatus::Immature)
557549
{

src/qt/walletmodel.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,6 @@ void WalletModel::checkBalanceChanged()
164164

165165
void WalletModel::updateTransaction(const QString &hash, int status)
166166
{
167-
if (status == CT_GOT_CONFLICT)
168-
{
169-
emit message(tr("Conflict Received"),
170-
tr("WARNING: Transaction may never be confirmed. Its input was seen being spent by another transaction on the network. Wait for confirmation!"),
171-
CClientUIInterface::MSG_WARNING);
172-
return;
173-
}
174-
175167
if(transactionTableModel)
176168
transactionTableModel->updateTransaction(hash, status);
177169

src/ui_interface.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ enum ChangeType
2121
{
2222
CT_NEW,
2323
CT_UPDATED,
24-
CT_DELETED,
25-
CT_GOT_CONFLICT
24+
CT_DELETED
2625
};
2726

2827
/** Signals for UI communication. */

src/wallet.cpp

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ bool CWallet::SetMaxVersion(int nVersion)
274274
return true;
275275
}
276276

277-
set<uint256> CWallet::GetConflicts(const uint256& txid, bool includeEquivalent) const
277+
set<uint256> CWallet::GetConflicts(const uint256& txid) const
278278
{
279279
set<uint256> result;
280280
AssertLockHeld(cs_wallet);
@@ -292,8 +292,7 @@ set<uint256> CWallet::GetConflicts(const uint256& txid, bool includeEquivalent)
292292
continue; // No conflict if zero or one spends
293293
range = mapTxSpends.equal_range(txin.prevout);
294294
for (TxSpends::const_iterator it = range.first; it != range.second; ++it)
295-
if (includeEquivalent || !wtx.IsEquivalentTo(mapWallet.at(it->second)))
296-
result.insert(it->second);
295+
result.insert(it->second);
297296
}
298297
return result;
299298
}
@@ -322,7 +321,6 @@ void CWallet::SyncMetaData(pair<TxSpends::iterator, TxSpends::iterator> range)
322321
const uint256& hash = it->second;
323322
CWalletTx* copyTo = &mapWallet[hash];
324323
if (copyFrom == copyTo) continue;
325-
if (!copyFrom->IsEquivalentTo(*copyTo)) continue;
326324
copyTo->mapValue = copyFrom->mapValue;
327325
copyTo->vOrderForm = copyFrom->vOrderForm;
328326
// fTimeReceivedIsTxTime not copied on purpose
@@ -610,20 +608,6 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet)
610608
// Notify UI of new or updated transaction
611609
NotifyTransactionChanged(this, hash, fInsertedNew ? CT_NEW : CT_UPDATED);
612610

613-
// Notifications for existing transactions that now have conflicts with this one
614-
if (fInsertedNew)
615-
{
616-
BOOST_FOREACH(const uint256& conflictHash, wtxIn.GetConflicts(false))
617-
{
618-
CWalletTx& txConflict = mapWallet[conflictHash];
619-
NotifyTransactionChanged(this, conflictHash, CT_UPDATED); //Updates UI table
620-
if (IsFromMe(txConflict) || IsMine(txConflict))
621-
{
622-
NotifyTransactionChanged(this, conflictHash, CT_GOT_CONFLICT); //Throws dialog
623-
}
624-
}
625-
}
626-
627611
// notify an external script when a wallet transaction comes in or is updated
628612
std::string strCmd = GetArg("-walletnotify", "");
629613

@@ -646,12 +630,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
646630
AssertLockHeld(cs_wallet);
647631
bool fExisted = mapWallet.count(tx.GetHash());
648632
if (fExisted && !fUpdate) return false;
649-
650-
bool fIsConflicting = IsConflicting(tx);
651-
if (fIsConflicting)
652-
nConflictsReceived++;
653-
654-
if (fExisted || IsMine(tx) || IsFromMe(tx) || fIsConflicting)
633+
if (fExisted || IsMine(tx) || IsFromMe(tx))
655634
{
656635
CWalletTx wtx(this,tx);
657636
// Get merkle branch if transaction was found in a block
@@ -940,7 +919,7 @@ void CWallet::ReacceptWalletTransactions()
940919

941920
int nDepth = wtx.GetDepthInMainChain();
942921

943-
if (!wtx.IsCoinBase() && nDepth < 0 && (IsMine(wtx) || IsFromMe(wtx)))
922+
if (!wtx.IsCoinBase() && nDepth < 0)
944923
{
945924
// Try to add to memory pool
946925
LOCK(mempool.cs);
@@ -960,13 +939,13 @@ void CWalletTx::RelayWalletTransaction()
960939
}
961940
}
962941

963-
set<uint256> CWalletTx::GetConflicts(bool includeEquivalent) const
942+
set<uint256> CWalletTx::GetConflicts() const
964943
{
965944
set<uint256> result;
966945
if (pwallet != NULL)
967946
{
968947
uint256 myHash = GetHash();
969-
result = pwallet->GetConflicts(myHash, includeEquivalent);
948+
result = pwallet->GetConflicts(myHash);
970949
result.erase(myHash);
971950
}
972951
return result;

src/wallet.h

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ class CWallet : public CCryptoKeyStore, public CWalletInterface
144144
MasterKeyMap mapMasterKeys;
145145
unsigned int nMasterKeyMaxID;
146146

147-
// Increment to cause UI refresh, similar to new block
148-
int64_t nConflictsReceived;
149-
150147
CWallet()
151148
{
152149
SetNull();
@@ -169,7 +166,6 @@ class CWallet : public CCryptoKeyStore, public CWalletInterface
169166
nNextResend = 0;
170167
nLastResend = 0;
171168
nTimeFirstKey = 0;
172-
nConflictsReceived = 0;
173169
}
174170

175171
std::map<uint256, CWalletTx> mapWallet;
@@ -322,13 +318,6 @@ class CWallet : public CCryptoKeyStore, public CWalletInterface
322318
{
323319
return (GetDebit(tx, ISMINE_ALL) > 0);
324320
}
325-
bool IsConflicting(const CTransaction& tx) const
326-
{
327-
BOOST_FOREACH(const CTxIn& txin, tx.vin)
328-
if (mapTxSpends.count(txin.prevout))
329-
return true;
330-
return false;
331-
}
332321
int64_t GetDebit(const CTransaction& tx, const isminefilter& filter) const
333322
{
334323
int64_t nDebit = 0;
@@ -401,7 +390,7 @@ class CWallet : public CCryptoKeyStore, public CWalletInterface
401390
int GetVersion() { LOCK(cs_wallet); return nWalletVersion; }
402391

403392
// Get wallet transactions that conflict with given transaction (spend same outputs)
404-
std::set<uint256> GetConflicts(const uint256& txid, bool includeEquivalent) const;
393+
std::set<uint256> GetConflicts(const uint256& txid) const;
405394

406395
/** Address book entry changed.
407396
* @note called with lock cs_wallet held.
@@ -812,7 +801,7 @@ class CWalletTx : public CMerkleTx
812801

813802
void RelayWalletTransaction();
814803

815-
std::set<uint256> GetConflicts(bool includeEquivalent=true) const;
804+
std::set<uint256> GetConflicts() const;
816805
};
817806

818807

0 commit comments

Comments
 (0)