Skip to content

Commit 46027e8

Browse files
committed
Merge #9112: Avoid ugly exception in log on unknown inv type
e9f25dd Avoid ugly exception in log on unknown inv type (Wladimir J. van der Laan)
2 parents 21e6c6b + e9f25dd commit 46027e8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/protocol.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,11 @@ std::string CInv::GetCommand() const
181181

182182
std::string CInv::ToString() const
183183
{
184-
return strprintf("%s %s", GetCommand(), hash.ToString());
184+
try {
185+
return strprintf("%s %s", GetCommand(), hash.ToString());
186+
} catch(const std::out_of_range &) {
187+
return strprintf("0x%08x %s", type, hash.ToString());
188+
}
185189
}
186190

187191
const std::vector<std::string> &getAllNetMessageTypes()

0 commit comments

Comments
 (0)