Skip to content

Commit

Permalink
Merge bitcoin#934: Fix Inv Bugs
Browse files Browse the repository at this point in the history
96fad76 Revert part of b669280 and instead fix unknown inv handling in ProcessMessage
  • Loading branch information
UdjinM6 authored and schinzelh committed Aug 11, 2016
1 parent 338b0ce commit 1f6d5ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5479,6 +5479,11 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
{
const CInv &inv = vInv[nInv];

if(!inv.IsKnownType()) {
LogPrint("net", "got inv of unknown type %d: %s peer=%d\n", inv.type, inv.hash.ToString(), pfrom->id);
continue;
}

boost::this_thread::interruption_point();
pfrom->AddInventoryKnown(inv);

Expand Down
5 changes: 2 additions & 3 deletions src/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ CInv::CInv(const std::string& strType, const uint256& hashIn)
}
}
if (i == ARRAYLEN(ppszTypeName))
LogPrint("net", "CInv::CInv(string, uint256) : unknown type '%s'\n", strType);
throw std::out_of_range(strprintf("CInv::CInv(string, uint256): unknown type '%s'", strType));
hash = hashIn;
}

Expand All @@ -255,8 +255,7 @@ bool CInv::IsKnownType() const
const char* CInv::GetCommand() const
{
if (!IsKnownType())
LogPrint("net", "CInv::GetCommand() : type=%d unknown type\n", type);

throw std::out_of_range(strprintf("CInv::GetCommand(): type=%d unknown type", type));
return ppszTypeName[type];
}

Expand Down

0 comments on commit 1f6d5ff

Please sign in to comment.