Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
KEP-973: pbft variables reside in storage
Browse files Browse the repository at this point in the history
  • Loading branch information
paularchard committed Feb 23, 2019
1 parent 6e254c1 commit 5279622
Show file tree
Hide file tree
Showing 19 changed files with 944 additions and 133 deletions.
2 changes: 1 addition & 1 deletion pbft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ add_library(pbft STATIC
pbft_config_store.cpp
database_pbft_service.cpp
database_pbft_service.hpp
)
pbft_persistent_state.cpp)

target_link_libraries(pbft utils pbft_operations proto)
target_include_directories(pbft PRIVATE ${JSONCPP_INCLUDE_DIRS} ${PROTO_INCLUDE_DIR})
Expand Down
18 changes: 9 additions & 9 deletions pbft/database_pbft_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ database_pbft_service::process_awaiting_operations()
this->crud->handle_request(op_it->second->get_request().sender(), request, nullptr);
}

if (this->next_request_sequence == this->next_checkpoint)
{
if (this->crud->save_state())
{
this->last_checkpoint = this->next_request_sequence;
}
}

this->io_context->post(std::bind(this->execute_handler, (*op_it).second));
}

Expand All @@ -149,14 +157,6 @@ database_pbft_service::process_awaiting_operations()
throw std::runtime_error("Failed to remove pbft_request from database! (" + std::to_string(uint8_t(result)) + ")");
}

if (this->next_request_sequence == this->next_checkpoint)
{
if (this->crud->save_state())
{
this->last_checkpoint = this->next_request_sequence;
}
}

++this->next_request_sequence;

this->save_next_request_sequence();
Expand All @@ -166,7 +166,7 @@ database_pbft_service::process_awaiting_operations()
bzn::hash_t
database_pbft_service::service_state_hash(uint64_t /*sequence_number*/) const
{
// TODO: not sure how this works...
// TODO: not sure how this works... (KEP-1203)

return "";
}
Expand Down

0 comments on commit 5279622

Please sign in to comment.