aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
authorPieter Wuille <[email protected]>2012-11-03 11:51:13 -0700
committerPieter Wuille <[email protected]>2012-11-03 11:51:13 -0700
commita56d3f8a10e3c9f844aee1f362635ae14b872023 (patch)
treeed49a51749249b172088c9b9937447cd79584f46 /src/wallet.cpp
parentMerge pull request #1973 from sipa/comconst (diff)
parentBugfix: do not keep relaying spent wallet transactions (diff)
downloaddiscoin-a56d3f8a10e3c9f844aee1f362635ae14b872023.tar.xz
discoin-a56d3f8a10e3c9f844aee1f362635ae14b872023.zip
Merge pull request #1971 from sipa/bugfix_norelayspent
Bugfix: do not keep relaying spent wallet transactions
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r--src/wallet.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index dc6169c4b..67b4e8f09 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -820,21 +820,17 @@ void CWallet::ReacceptWalletTransactions()
void CWalletTx::RelayWalletTransaction()
{
- CCoinsViewCache& coins = *pcoinsTip;
BOOST_FOREACH(const CMerkleTx& tx, vtxPrev)
{
- if (!tx.IsCoinBase())
- {
- uint256 hash = tx.GetHash();
- if (!coins.HaveCoins(hash))
- RelayMessage(CInv(MSG_TX, hash), (CTransaction)tx);
+ if (!tx.IsCoinBase()) {
+ if (tx.GetDepthInMainChain() == 0)
+ RelayMessage(CInv(MSG_TX, tx.GetHash()), (CTransaction)tx);
}
}
if (!IsCoinBase())
{
- uint256 hash = GetHash();
- if (!coins.HaveCoins(hash))
- {
+ if (GetDepthInMainChain() == 0) {
+ uint256 hash = GetHash();
printf("Relaying wtx %s\n", hash.ToString().substr(0,10).c_str());
RelayMessage(CInv(MSG_TX, hash), (CTransaction)*this);
}