зеркало из https://github.com/microsoft/CCF.git
Ignore historical service open in global hook (#3547)
This commit is contained in:
Родитель
cc247f73eb
Коммит
d983540b17
|
@ -1 +1 @@
|
|||
trigger happy
|
||||
meow
|
||||
|
|
|
@ -1830,16 +1830,30 @@ namespace ccf
|
|||
|
||||
network.tables->set_global_hook(
|
||||
network.service.get_name(),
|
||||
network.service.wrap_commit_hook(
|
||||
[this](kv::Version hook_version, const Service::Write& w) {
|
||||
if (!w.has_value())
|
||||
{
|
||||
throw std::logic_error("Unexpected deletion in service value");
|
||||
}
|
||||
network.service.wrap_commit_hook([this](
|
||||
kv::Version hook_version,
|
||||
const Service::Write& w) {
|
||||
if (!w.has_value())
|
||||
{
|
||||
throw std::logic_error("Unexpected deletion in service value");
|
||||
}
|
||||
|
||||
network.identity->set_certificate(w->cert);
|
||||
open_user_frontend();
|
||||
}));
|
||||
// Service open on historical service has no effect
|
||||
auto hook_pubk_pem =
|
||||
crypto::public_key_pem_from_cert(crypto::cert_pem_to_der(w->cert));
|
||||
auto current_pubk_pem =
|
||||
crypto::make_key_pair(network.identity->priv_key)->public_key_pem();
|
||||
if (hook_pubk_pem != current_pubk_pem)
|
||||
{
|
||||
LOG_TRACE_FMT(
|
||||
"Ignoring historical service open at seqno {} for {}",
|
||||
hook_version,
|
||||
w->cert.str());
|
||||
return;
|
||||
}
|
||||
network.identity->set_certificate(w->cert);
|
||||
open_user_frontend();
|
||||
}));
|
||||
}
|
||||
|
||||
kv::Version get_last_recovered_signed_idx() override
|
||||
|
|
Загрузка…
Ссылка в новой задаче