aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2013-12-04 15:40:51 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2013-12-04 15:40:51 +0100
commit4ef92a9067a51c962d662b857704f63d936effa0 (patch)
treef86a2ed2b7592e37f6a86b89417f14db30e024b9
parent00cfc9f0749daed5137bea78a4234c3d074e8889 (diff)
Refuse to retransmit transactions without vins
Versions of bitcoin before 0.8.6 have a bug that inserted empty transactions into the vtxPrev in the wallet, which will cause the node to be banned when retransmitted, hence add a check for !tx.vin.empty() before RelayTransaction.
-rw-r--r--src/wallet.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index 14d685d6e2..ab6a926f78 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -895,7 +895,10 @@ void CWalletTx::RelayWalletTransaction()
{
BOOST_FOREACH(const CMerkleTx& tx, vtxPrev)
{
- if (!tx.IsCoinBase())
+ // Important: versions of bitcoin before 0.8.6 had a bug that inserted
+ // empty transactions into the vtxPrev, which will cause the node to be
+ // banned when retransmitted, hence the check for !tx.vin.empty()
+ if (!tx.IsCoinBase() && !tx.vin.empty())
if (tx.GetDepthInMainChain() == 0)
RelayTransaction((CTransaction)tx, tx.GetHash());
}