File tree Expand file tree Collapse file tree 1 file changed +0
-25
lines changed
src/protocol/libp2p/kademlia Expand file tree Collapse file tree 1 file changed +0
-25
lines changed Original file line number Diff line number Diff line change @@ -656,31 +656,6 @@ impl Kademlia {
656656 Ok ( ( ) )
657657 }
658658 QueryAction :: GetRecordQueryDone { query_id, records } => {
659- // Considering this gives a view of all peers and their records, some peers may have
660- // outdated records. Store only the record which is backed by most
661- // peers.
662- let now = std:: time:: Instant :: now ( ) ;
663- let rec = records
664- . iter ( )
665- . filter_map ( |peer_record| {
666- if peer_record. record . is_expired ( now) {
667- None
668- } else {
669- Some ( & peer_record. record )
670- }
671- } )
672- . fold ( HashMap :: new ( ) , |mut acc, rec| {
673- * acc. entry ( rec) . or_insert ( 0 ) += 1 ;
674- acc
675- } )
676- . into_iter ( )
677- . max_by_key ( |( _, v) | * v)
678- . map ( |( k, _) | k) ;
679-
680- if let Some ( record) = rec {
681- self . store . put ( record. clone ( ) ) ;
682- }
683-
684659 let _ = self
685660 . event_tx
686661 . send ( KademliaEvent :: GetRecordSuccess {
You can’t perform that action at this time.
0 commit comments