Consensus reliability enhancements (#62)

* Implemented going observer mode, fixed genesis lcl retrieval issue and stage closing time.

* Fixed clearing all user output instead of consensed outputs

* Modified waiting time to improve performance.

* Fixed deadlock of waiting for insufficient peers because of recent changes.

* Removed initial waiting time for peer connections to start consensus.
This commit is contained in:
Asanka Indrajith
2019-12-06 05:08:51 -05:00
committed by GitHub
parent 7428d42aad
commit b506b34b4f
6 changed files with 85 additions and 49 deletions

View File

@@ -256,6 +256,10 @@ bool check_required_lcl_availability(const p2p::history_request &hr)
return false;
}
}
else
{
return false; //Very rare case: node asking for the genisis lcl.
}
return true;
}
@@ -285,14 +289,14 @@ const p2p::history_response retrieve_ledger_history(const p2p::history_request &
//eventhough sequence number are same, lcl hash can be changed if one of node is in a fork condition.
if (hr.minimum_lcl != itr->second)
{
LOG_DBG << "Invalid minimum ledger. Recieved min hash: "<< min_lcl_hash << " Node hash: " << itr->second;
LOG_DBG << "Invalid minimum ledger. Recieved min hash: " << min_lcl_hash << " Node hash: " << itr->second;
history_response.error = p2p::LEDGER_RESPONSE_ERROR::INVALID_MIN_LEDGER;
return history_response;
}
}
else if (min_seq_no > cons::ctx.lcl_list.rbegin()->first) //Recieved minimum lcl sequence is ahead of node's lcl sequence.
else if (min_seq_no > cons::ctx.lcl_list.rbegin()->first) //Recieved minimum lcl sequence is ahead of node's lcl sequence.
{
LOG_DBG << "Invalid minimum ledger. Recieved minimum sequence number is ahead of node current lcl sequence. hash: "<< min_lcl_hash;
LOG_DBG << "Invalid minimum ledger. Recieved minimum sequence number is ahead of node current lcl sequence. hash: " << min_lcl_hash;
history_response.error = p2p::LEDGER_RESPONSE_ERROR::INVALID_MIN_LEDGER;
return history_response;
}
@@ -313,7 +317,7 @@ const p2p::history_response retrieve_ledger_history(const p2p::history_request &
lcl_list.begin(),
lcl_list.lower_bound(min_seq_no));
//Get raw content of lcls that going to be send.
//Get raw content of lcls that going to be send.
for (auto &[seq_no, lcl_hash] : lcl_list)
{
p2p::history_ledger ledger;