Skip to content

Commit

Permalink
[release/2.x] Cherry pick: Avoid rewriting node info when `retired_co…
Browse files Browse the repository at this point in the history
…mmitted` is already set (#5094) (#5096)
  • Loading branch information
achamayou authored Mar 10, 2023
1 parent 1c872d6 commit c992252
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.0.18]

[2.0.18]: https://github.com/microsoft/CCF/releases/tag/ccf-2.0.18

### Changed

- Avoid rewriting node info when `retired_committed` is already set (#5094).

## [2.0.17]

[2.0.17]: https://github.com/microsoft/CCF/releases/tag/ccf-2.0.17
Expand Down
16 changes: 5 additions & 11 deletions src/node/rpc/node_frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -623,23 +623,17 @@ namespace ccf
// This endpoint should only be called internally once it is certain
// that all nodes recorded as Retired will no longer issue transactions.
auto nodes = ctx.tx.rw(network.nodes);
auto node_endorsed_certificates =
ctx.tx.rw(network.node_endorsed_certificates);
nodes->foreach([this, &nodes, &node_endorsed_certificates](
const auto& node_id, const auto& node_info) {
nodes->foreach([this, &nodes](const auto& node_id, auto node_info) {
if (
node_info.status == ccf::NodeStatus::RETIRED &&
node_id != this->context.get_node_id())
node_id != this->context.get_node_id() &&
!node_info.retired_committed)
{
// Set retired_committed on nodes for which RETIRED status
// has been committed. This endpoint is only triggered for a
// a given node once their retirement has been committed.
auto node = nodes->get(node_id);
if (node.has_value())
{
node->retired_committed = true;
nodes->put(node_id, node.value());
}
node_info.retired_committed = true;
nodes->put(node_id, node_info);

LOG_DEBUG_FMT("Setting retired_committed on node {}", node_id);
}
Expand Down

0 comments on commit c992252

Please sign in to comment.