diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 39d59f358b42..aa2a83797f8c 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -25,6 +25,7 @@ #include "reverse_iterator.h" #include "scheduler.h" #include "tinyformat.h" +#include "txdb.h" #include "txmempool.h" #include "ui_interface.h" #include "util.h" @@ -1008,7 +1009,8 @@ bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main) return recentRejects->contains(inv.hash) || mempool.exists(inv.hash) || pcoinsTip->HaveCoinInCache(COutPoint(inv.hash, 0)) || // Best effort: only try output 0 and 1 - pcoinsTip->HaveCoinInCache(COutPoint(inv.hash, 1)); + pcoinsTip->HaveCoinInCache(COutPoint(inv.hash, 1)) || + (fTxIndex && pblocktree->HasTxIndex(inv.hash)); } case MSG_BLOCK: diff --git a/src/txdb.cpp b/src/txdb.cpp index 9acfea075f54..49e6dc2705b1 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -240,6 +240,10 @@ bool CBlockTreeDB::WriteBatchSync(const std::vector > &list); bool ReadSpentIndex(CSpentIndexKey &key, CSpentIndexValue &value);