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");
RLP status(statusBytes);
auto protocolVersion = (unsigned)status[0];
auto minorProtocolVersion = (unsigned)status[1];
auto databaseVersion = (unsigned)status[2];
m_action =
protocolVersion != eth::c_protocolVersion || databaseVersion != c_databaseVersion ?
WithExisting::Kill
: minorProtocolVersion != eth::c_minorProtocolVersion ?
WithExisting::Verify
:
WithExisting::Trust;
try
{
auto protocolVersion = (unsigned)status[0];
auto minorProtocolVersion = (unsigned)status[1];
auto databaseVersion = (unsigned)status[2];
m_action =
protocolVersion != eth::c_protocolVersion || databaseVersion != c_databaseVersion ?
WithExisting::Kill
: minorProtocolVersion != eth::c_minorProtocolVersion ?
WithExisting::Verify
:
WithExisting::Trust;
}
catch (...)
{
m_action = WithExisting::Kill;
}
}
void VersionChecker::setOk()

Loading…
Cancel
Save