Skip to content

Commit

Permalink
Few inv related fixes:
Browse files Browse the repository at this point in the history
- add missing strings and make inv strings a bit more consistent (imo)
- remove "unknown" types that were used to prevent errors thrown at user with old wallet,
  just log such errors in debug mode for "net" category. Should also make behaviour of functions
  relaing on CInv::IsKnownType() more adequate
  (and it doesn't make sense to warn users by throwing errors at them in such situations anyway I guess)
  • Loading branch information
UdjinM6 committed Jul 2, 2015
1 parent a89b0e7 commit b669280
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions src/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,15 @@ static const char* ppszTypeName[] =
"tx lock request",
"tx lock vote",
"spork",
"masternode winner",
"masternode scan",
"masternode vote",
"masternode proposal",
"masternode quorum",
"masternode announce",
"masternode ping",
"unknown",
"unknown",
"unknown",
"unknown",
"unknown",
"unknown"
"mn winner",
"mn scan error",
"mn budget vote",
"mn budget proposal",
"mn budget finalized",
"mn budget finalized vote",
"mn quorum",
"mn announce",
"mn ping"
};

CMessageHeader::CMessageHeader()
Expand Down Expand Up @@ -133,7 +129,7 @@ CInv::CInv(const std::string& strType, const uint256& hashIn)
}
}
if (i == ARRAYLEN(ppszTypeName))
throw std::out_of_range(strprintf("CInv::CInv(string, uint256) : unknown type '%s'", strType));
LogPrint("net", "CInv::CInv(string, uint256) : unknown type '%s'", strType);
hash = hashIn;
}

Expand All @@ -150,7 +146,8 @@ bool CInv::IsKnownType() const
const char* CInv::GetCommand() const
{
if (!IsKnownType())
throw std::out_of_range(strprintf("CInv::GetCommand() : type=%d unknown type", type));
LogPrint("net", "CInv::GetCommand() : type=%d unknown type", type);

return ppszTypeName[type];
}

Expand Down

0 comments on commit b669280

Please sign in to comment.