|
|
@ -274,7 +274,7 @@ bool CWallet::SetMaxVersion(int nVersion) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
set<uint256> CWallet::GetConflicts(const uint256& txid, bool includeEquivalent) const |
|
|
|
set<uint256> CWallet::GetConflicts(const uint256& txid) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
set<uint256> result; |
|
|
|
set<uint256> result; |
|
|
|
AssertLockHeld(cs_wallet); |
|
|
|
AssertLockHeld(cs_wallet); |
|
|
@ -292,7 +292,6 @@ set<uint256> CWallet::GetConflicts(const uint256& txid, bool includeEquivalent) |
|
|
|
continue; // No conflict if zero or one spends
|
|
|
|
continue; // No conflict if zero or one spends
|
|
|
|
range = mapTxSpends.equal_range(txin.prevout); |
|
|
|
range = mapTxSpends.equal_range(txin.prevout); |
|
|
|
for (TxSpends::const_iterator it = range.first; it != range.second; ++it) |
|
|
|
for (TxSpends::const_iterator it = range.first; it != range.second; ++it) |
|
|
|
if (includeEquivalent || !wtx.IsEquivalentTo(mapWallet.at(it->second))) |
|
|
|
|
|
|
|
result.insert(it->second); |
|
|
|
result.insert(it->second); |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
return result; |
|
|
@ -322,7 +321,6 @@ void CWallet::SyncMetaData(pair<TxSpends::iterator, TxSpends::iterator> range) |
|
|
|
const uint256& hash = it->second; |
|
|
|
const uint256& hash = it->second; |
|
|
|
CWalletTx* copyTo = &mapWallet[hash]; |
|
|
|
CWalletTx* copyTo = &mapWallet[hash]; |
|
|
|
if (copyFrom == copyTo) continue; |
|
|
|
if (copyFrom == copyTo) continue; |
|
|
|
if (!copyFrom->IsEquivalentTo(*copyTo)) continue; |
|
|
|
|
|
|
|
copyTo->mapValue = copyFrom->mapValue; |
|
|
|
copyTo->mapValue = copyFrom->mapValue; |
|
|
|
copyTo->vOrderForm = copyFrom->vOrderForm; |
|
|
|
copyTo->vOrderForm = copyFrom->vOrderForm; |
|
|
|
// fTimeReceivedIsTxTime not copied on purpose
|
|
|
|
// fTimeReceivedIsTxTime not copied on purpose
|
|
|
@ -610,20 +608,6 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet) |
|
|
|
// Notify UI of new or updated transaction
|
|
|
|
// Notify UI of new or updated transaction
|
|
|
|
NotifyTransactionChanged(this, hash, fInsertedNew ? CT_NEW : CT_UPDATED); |
|
|
|
NotifyTransactionChanged(this, hash, fInsertedNew ? CT_NEW : CT_UPDATED); |
|
|
|
|
|
|
|
|
|
|
|
// Notifications for existing transactions that now have conflicts with this one
|
|
|
|
|
|
|
|
if (fInsertedNew) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
BOOST_FOREACH(const uint256& conflictHash, wtxIn.GetConflicts(false)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CWalletTx& txConflict = mapWallet[conflictHash]; |
|
|
|
|
|
|
|
NotifyTransactionChanged(this, conflictHash, CT_UPDATED); //Updates UI table
|
|
|
|
|
|
|
|
if (IsFromMe(txConflict) || IsMine(txConflict)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
NotifyTransactionChanged(this, conflictHash, CT_GOT_CONFLICT); //Throws dialog
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// notify an external script when a wallet transaction comes in or is updated
|
|
|
|
// notify an external script when a wallet transaction comes in or is updated
|
|
|
|
std::string strCmd = GetArg("-walletnotify", ""); |
|
|
|
std::string strCmd = GetArg("-walletnotify", ""); |
|
|
|
|
|
|
|
|
|
|
@ -646,12 +630,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl |
|
|
|
AssertLockHeld(cs_wallet); |
|
|
|
AssertLockHeld(cs_wallet); |
|
|
|
bool fExisted = mapWallet.count(tx.GetHash()); |
|
|
|
bool fExisted = mapWallet.count(tx.GetHash()); |
|
|
|
if (fExisted && !fUpdate) return false; |
|
|
|
if (fExisted && !fUpdate) return false; |
|
|
|
|
|
|
|
if (fExisted || IsMine(tx) || IsFromMe(tx)) |
|
|
|
bool fIsConflicting = IsConflicting(tx); |
|
|
|
|
|
|
|
if (fIsConflicting) |
|
|
|
|
|
|
|
nConflictsReceived++; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (fExisted || IsMine(tx) || IsFromMe(tx) || fIsConflicting) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
CWalletTx wtx(this,tx); |
|
|
|
CWalletTx wtx(this,tx); |
|
|
|
// Get merkle branch if transaction was found in a block
|
|
|
|
// Get merkle branch if transaction was found in a block
|
|
|
@ -940,7 +919,7 @@ void CWallet::ReacceptWalletTransactions() |
|
|
|
|
|
|
|
|
|
|
|
int nDepth = wtx.GetDepthInMainChain(); |
|
|
|
int nDepth = wtx.GetDepthInMainChain(); |
|
|
|
|
|
|
|
|
|
|
|
if (!wtx.IsCoinBase() && nDepth < 0 && (IsMine(wtx) || IsFromMe(wtx))) |
|
|
|
if (!wtx.IsCoinBase() && nDepth < 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Try to add to memory pool
|
|
|
|
// Try to add to memory pool
|
|
|
|
LOCK(mempool.cs); |
|
|
|
LOCK(mempool.cs); |
|
|
@ -960,13 +939,13 @@ void CWalletTx::RelayWalletTransaction() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
set<uint256> CWalletTx::GetConflicts(bool includeEquivalent) const |
|
|
|
set<uint256> CWalletTx::GetConflicts() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
set<uint256> result; |
|
|
|
set<uint256> result; |
|
|
|
if (pwallet != NULL) |
|
|
|
if (pwallet != NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint256 myHash = GetHash(); |
|
|
|
uint256 myHash = GetHash(); |
|
|
|
result = pwallet->GetConflicts(myHash, includeEquivalent); |
|
|
|
result = pwallet->GetConflicts(myHash); |
|
|
|
result.erase(myHash); |
|
|
|
result.erase(myHash); |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
return result; |
|
|
|