Skip to content

Commit 4ef92a9

Browse files
committed
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.
1 parent 00cfc9f commit 4ef92a9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/wallet.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,10 @@ void CWalletTx::RelayWalletTransaction()
895895
{
896896
BOOST_FOREACH(const CMerkleTx& tx, vtxPrev)
897897
{
898-
if (!tx.IsCoinBase())
898+
// Important: versions of bitcoin before 0.8.6 had a bug that inserted
899+
// empty transactions into the vtxPrev, which will cause the node to be
900+
// banned when retransmitted, hence the check for !tx.vin.empty()
901+
if (!tx.IsCoinBase() && !tx.vin.empty())
899902
if (tx.GetDepthInMainChain() == 0)
900903
RelayTransaction((CTransaction)tx, tx.GetHash());
901904
}

0 commit comments

Comments
 (0)