cryptonote_protocol: misc fixes to the new sync algorithm

Fix sync wedge corner case:
It could happen if a connection went into standby mode, while
it was the one which had requested the next span, and that span
was still waiting for the data, and that peer is not on the
main chain. Other peers can then start asking for that data
again and again, but never get it as only that forked peer does.

And various other fixes
This commit is contained in:
moneromooo-monero 2017-08-18 20:14:23 +01:00
parent 4466b6d1b0
commit 70b8c6d77a
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
5 changed files with 109 additions and 38 deletions

View file

@ -111,6 +111,7 @@ namespace cryptonote
std::list<connection_info> get_connections();
const block_queue &get_block_queue() const { return m_block_queue; }
void stop();
void on_connection_close(cryptonote_connection_context &context);
private:
//----------------- commands handlers ----------------------------------------------
int handle_notify_new_block(int command, NOTIFY_NEW_BLOCK::request& arg, cryptonote_connection_context& context);
@ -133,6 +134,7 @@ namespace cryptonote
bool should_download_next_span(cryptonote_connection_context& context) const;
void drop_connection(cryptonote_connection_context &context, bool add_fail, bool flush_all_spans);
bool kick_idle_peers();
int try_add_next_blocks(cryptonote_connection_context &context);
t_core& m_core;