UI to alert of respend attempt affecting wallet.
Respend transactions that conflict with transactions already in the wallet are added to it. They are not displayed unless they also involve the wallet, or get into a block. If they do not involve the wallet, they continue not to affect balance. Transactions that involve the wallet, and have conflicting non-equivalent transactions, are highlighted in red. When the conflict first occurs, a modal dialog is thrown. CWallet::SyncMetaData is changed to sync only to equivalent transactions. When a conflict is added to the wallet, counter nConflictsReceived is incremented. This acts like a change in active block height for the purpose of triggering UI updates.
This commit is contained in:
@@ -20,7 +20,8 @@ class TransactionStatus
|
||||
public:
|
||||
TransactionStatus():
|
||||
countsForBalance(false), sortKey(""),
|
||||
matures_in(0), status(Offline), depth(0), open_for(0), cur_num_blocks(-1)
|
||||
matures_in(0), status(Offline), hasConflicting(false), depth(0), open_for(0), cur_num_blocks(-1),
|
||||
cur_num_conflicts(-1)
|
||||
{ }
|
||||
|
||||
enum Status {
|
||||
@@ -51,6 +52,10 @@ public:
|
||||
/** @name Reported status
|
||||
@{*/
|
||||
Status status;
|
||||
|
||||
// Has conflicting transactions spending same prevout
|
||||
bool hasConflicting;
|
||||
|
||||
qint64 depth;
|
||||
qint64 open_for; /**< Timestamp if status==OpenUntilDate, otherwise number
|
||||
of additional blocks that need to be mined before
|
||||
@@ -59,6 +64,10 @@ public:
|
||||
|
||||
/** Current number of blocks (to know whether cached status is still valid) */
|
||||
int cur_num_blocks;
|
||||
|
||||
/** Number of conflicts received into wallet as of last status update */
|
||||
int64_t cur_num_conflicts;
|
||||
|
||||
};
|
||||
|
||||
/** UI model for a transaction. A core transaction can be represented by multiple UI transactions if it has
|
||||
@@ -133,7 +142,7 @@ public:
|
||||
|
||||
/** Return whether a status update is needed.
|
||||
*/
|
||||
bool statusUpdateNeeded();
|
||||
bool statusUpdateNeeded(int64_t nConflictsReceived);
|
||||
};
|
||||
|
||||
#endif // TRANSACTIONRECORD_H
|
||||
|
||||
Reference in New Issue
Block a user