Node table limiting and cache for node filter (#10288)

* Fix nasty typo in NodeTable::update (add ;)

* Add limiting for NodeTable

* Add cache for NodeFilter

* Use expect instead of unwrap

* Move node in ordered_ids if it exists there in note_failure and note_success + fix expect msg

* Add comment

* Improve code style

* DRY in note_failure and note_success

* Fix nodes ordering

* Simplify match expression

* Add tests for get_index_to_insert

* Remove get_mut method from NodeTable, Add get method to NodeTable

* Fix table_last_contact_order for macos failing because of lost nanosecond precision
This commit is contained in:
Vladyslav Lupashevskyi
2019-04-05 14:30:31 +03:00
committed by Talha Cross
parent 10e1787ad1
commit 8132d38b50
5 changed files with 200 additions and 49 deletions

View File

@@ -583,7 +583,9 @@ fn execute_impl<Cr, Rr>(cmd: RunCmd, logger: Arc<RotatingLogger>, on_client_rq:
let private_tx_provider = private_tx_service.provider();
let connection_filter = connection_filter_address.map(|a| Arc::new(NodeFilter::new(Arc::downgrade(&client) as Weak<BlockChainClient>, a)));
let snapshot_service = service.snapshot_service();
if let Some(filter) = connection_filter.clone() {
service.add_notify(filter.clone());
}
// initialize the local node information store.
let store = {
let db = service.db();