From f1e8edc9665b89a2f6d1caf2191c2babbec2a659 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 4 Dec 2013 15:40:51 +0100 Subject: [PATCH] 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. --- src/wallet.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wallet.cpp b/src/wallet.cpp index 8f05fc1cb..2d79b3bd9 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -847,7 +847,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()); }