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-05 11:05:14 +0100
commitec93d0aa4389b41d36f90678901322d9f135f743 (patch)
tree244aae51899043f0b32bce63d16b726613498112
parent8c3ba8be017791799dcfbc2126c24b0580fe48d5 (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 73de759b5e..a519c7a17f 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -844,7 +844,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());
}