aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2014-07-21 08:52:45 +0200
committerWladimir J. van der Laan <[email protected]>2014-07-21 08:52:54 +0200
commit3bc4fd955e8845c2aea1d04c7e3cf3e85ee53906 (patch)
tree848534bd7e65b1c81e2893e9957c1254090582c1 /src/wallet.cpp
parentqt: Move SplashFinished to after ClientModel/WalletModel creation (diff)
parentRevert "CBloomFilter::clear() method" (diff)
downloaddiscoin-3bc4fd955e8845c2aea1d04c7e3cf3e85ee53906.tar.xz
discoin-3bc4fd955e8845c2aea1d04c7e3cf3e85ee53906.zip
Merge pull request #4558
8f3f94a Revert "CBloomFilter::clear() method" (Wladimir J. van der Laan) 98e84aa Revert "Relay double-spends, subject to anti-DOS" (Wladimir J. van der Laan) 3015e0b Revert "UI to alert of respend attempt affecting wallet." (Wladimir J. van der Laan) 39d3f2c Revert "Add -respendnotify option and new RPC data" (Wladimir J. van der Laan) 680f725 Revert "Add release notes entry" (Wladimir J. van der Laan) ad26dc9 Revert "Formatting, spelling, comment fixes." (Wladimir J. van der Laan) cd057bf Revert "Check signatures before respend relay" (Wladimir J. van der Laan) 67cc8f2 Revert "Remove signal DoubleSpendDetected, use function" (Wladimir J. van der Laan)
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r--src/wallet.cpp41
1 files changed, 6 insertions, 35 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index efefb71b6..7c04743c0 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -274,7 +274,7 @@ bool CWallet::SetMaxVersion(int nVersion)
return true;
}
-set<uint256> CWallet::GetConflicts(const uint256& txid, bool includeEquivalent) const
+set<uint256> CWallet::GetConflicts(const uint256& txid) const
{
set<uint256> result;
AssertLockHeld(cs_wallet);
@@ -292,8 +292,7 @@ set<uint256> CWallet::GetConflicts(const uint256& txid, bool includeEquivalent)
continue; // No conflict if zero or one spends
range = mapTxSpends.equal_range(txin.prevout);
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;
}
@@ -322,7 +321,6 @@ void CWallet::SyncMetaData(pair<TxSpends::iterator, TxSpends::iterator> range)
const uint256& hash = it->second;
CWalletTx* copyTo = &mapWallet[hash];
if (copyFrom == copyTo) continue;
- if (!copyFrom->IsEquivalentTo(*copyTo)) continue;
copyTo->mapValue = copyFrom->mapValue;
copyTo->vOrderForm = copyFrom->vOrderForm;
// fTimeReceivedIsTxTime not copied on purpose
@@ -610,28 +608,6 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet)
// Notify UI of new or updated transaction
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
- // external respend notify
- std::string strCmd = GetArg("-respendnotify", "");
- if (!strCmd.empty())
- {
- boost::replace_all(strCmd, "%s", wtxIn.GetHash().GetHex());
- boost::replace_all(strCmd, "%t", conflictHash.GetHex());
- boost::thread t(runCommand, strCmd); // thread runs free
- }
- }
- }
- }
-
// notify an external script when a wallet transaction comes in or is updated
std::string strCmd = GetArg("-walletnotify", "");
@@ -654,12 +630,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
AssertLockHeld(cs_wallet);
bool fExisted = mapWallet.count(tx.GetHash());
if (fExisted && !fUpdate) return false;
-
- bool fIsConflicting = IsConflicting(tx);
- if (fIsConflicting)
- nConflictsReceived++;
-
- if (fExisted || IsMine(tx) || IsFromMe(tx) || fIsConflicting)
+ if (fExisted || IsMine(tx) || IsFromMe(tx))
{
CWalletTx wtx(this,tx);
// Get merkle branch if transaction was found in a block
@@ -948,7 +919,7 @@ void CWallet::ReacceptWalletTransactions()
int nDepth = wtx.GetDepthInMainChain();
- if (!wtx.IsCoinBase() && nDepth < 0 && (IsMine(wtx) || IsFromMe(wtx)))
+ if (!wtx.IsCoinBase() && nDepth < 0)
{
// Try to add to memory pool
LOCK(mempool.cs);
@@ -968,13 +939,13 @@ void CWalletTx::RelayWalletTransaction()
}
}
-set<uint256> CWalletTx::GetConflicts(bool includeEquivalent) const
+set<uint256> CWalletTx::GetConflicts() const
{
set<uint256> result;
if (pwallet != NULL)
{
uint256 myHash = GetHash();
- result = pwallet->GetConflicts(myHash, includeEquivalent);
+ result = pwallet->GetConflicts(myHash);
result.erase(myHash);
}
return result;