Refactored consensus into 3 rounds. (#144)

* Refactored consensus into 3 stages and removed stage 0.
* Consensus threshold calculation improvements.
* Refactored candidate user input processing.
* Renamed proposal sent timestamp field.
* Introduced comm_session display name.
This commit is contained in:
Ravin Perera
2020-11-07 15:01:01 +05:30
committed by GitHub
parent 51173e37f2
commit ba0cae019d
17 changed files with 568 additions and 516 deletions

View File

@@ -222,7 +222,7 @@ namespace msg::fbuf::p2pmsg
p2p::proposal p;
p.pubkey = flatbuff_bytes_to_sv(pubkey);
p.timestamp = timestamp;
p.sent_timestamp = timestamp;
p.time = msg.time();
p.stage = msg.stage();
p.lcl = flatbuff_bytes_to_sv(lcl);
@@ -638,10 +638,10 @@ namespace msg::fbuf::p2pmsg
//---Conversion helpers from flatbuffers data types to std data types---//
const std::unordered_map<std::string, const std::list<usr::user_input>>
const std::unordered_map<std::string, std::list<usr::user_input>>
flatbuf_user_input_group_to_user_input_map(const flatbuffers::Vector<flatbuffers::Offset<UserInputGroup>> *fbvec)
{
std::unordered_map<std::string, const std::list<usr::user_input>> map;
std::unordered_map<std::string, std::list<usr::user_input>> map;
map.reserve(fbvec->size());
for (const UserInputGroup *group : *fbvec)
{
@@ -664,7 +664,7 @@ namespace msg::fbuf::p2pmsg
//---These are used in constructing Flatbuffer messages using builders---//
const flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<UserInputGroup>>>
user_input_map_to_flatbuf_user_input_group(flatbuffers::FlatBufferBuilder &builder, const std::unordered_map<std::string, const std::list<usr::user_input>> &map)
user_input_map_to_flatbuf_user_input_group(flatbuffers::FlatBufferBuilder &builder, const std::unordered_map<std::string, std::list<usr::user_input>> &map)
{
std::vector<flatbuffers::Offset<UserInputGroup>> fbvec;
fbvec.reserve(map.size());