Browse Source

Don't crash when the status is bad.

cl-refactor
Gav Wood 10 years ago
parent
commit
1c1951a39b
  1. 27
      libethereum/Client.cpp

27
libethereum/Client.cpp

@ -40,16 +40,23 @@ VersionChecker::VersionChecker(string const& _dbPath):
{ {
bytes statusBytes = contents(m_path + "/status"); bytes statusBytes = contents(m_path + "/status");
RLP status(statusBytes); RLP status(statusBytes);
auto protocolVersion = (unsigned)status[0]; try
auto minorProtocolVersion = (unsigned)status[1]; {
auto databaseVersion = (unsigned)status[2]; auto protocolVersion = (unsigned)status[0];
m_action = auto minorProtocolVersion = (unsigned)status[1];
protocolVersion != eth::c_protocolVersion || databaseVersion != c_databaseVersion ? auto databaseVersion = (unsigned)status[2];
WithExisting::Kill m_action =
: minorProtocolVersion != eth::c_minorProtocolVersion ? protocolVersion != eth::c_protocolVersion || databaseVersion != c_databaseVersion ?
WithExisting::Verify WithExisting::Kill
: : minorProtocolVersion != eth::c_minorProtocolVersion ?
WithExisting::Trust; WithExisting::Verify
:
WithExisting::Trust;
}
catch (...)
{
m_action = WithExisting::Kill;
}
} }
void VersionChecker::setOk() void VersionChecker::setOk()

Loading…
Cancel
Save