Skip to content

Commit d1bf045

Browse files
sanityclaude
andcommitted
fix: resolve compilation errors after rebase
- Use addr() instead of peer() for live_tx_tracker methods (expect SocketAddr) - Remove duplicate get_peer_location_by_addr function 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 74f4e77 commit d1bf045

File tree

2 files changed

+3
-31
lines changed

2 files changed

+3
-31
lines changed

crates/core/src/ring/connection_manager.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -373,34 +373,6 @@ impl ConnectionManager {
373373
None
374374
}
375375

376-
/// Look up a PeerKeyLocation by socket address from connections_by_location or transient connections.
377-
/// Used for connection-based routing when we need full peer info from just an address.
378-
pub fn get_peer_location_by_addr(&self, addr: SocketAddr) -> Option<PeerKeyLocation> {
379-
// Check connections by location
380-
let connections = self.connections_by_location.read();
381-
for conns in connections.values() {
382-
for conn in conns {
383-
if conn.location.addr() == addr {
384-
return Some(conn.location.clone());
385-
}
386-
}
387-
}
388-
drop(connections);
389-
390-
// Check transient connections - construct PeerKeyLocation from PeerId
391-
if let Some((peer, entry)) = self
392-
.transient_connections
393-
.iter()
394-
.find(|e| e.key().addr == addr)
395-
.map(|e| (e.key().clone(), e.value().clone()))
396-
{
397-
let mut pkl = PeerKeyLocation::new(peer.pub_key, peer.addr);
398-
pkl.location = entry.location;
399-
return Some(pkl);
400-
}
401-
None
402-
}
403-
404376
pub fn is_gateway(&self) -> bool {
405377
self.is_gateway
406378
}

crates/core/src/ring/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ impl Ring {
355355

356356
pub async fn prune_connection(&self, peer: PeerId) {
357357
tracing::debug!(%peer, "Removing connection");
358-
self.live_tx_tracker.prune_transactions_from_peer(&peer);
358+
self.live_tx_tracker.prune_transactions_from_peer(peer.addr);
359359
// This case would be when a connection is being open, so peer location hasn't been recorded yet and we can ignore everything below
360360
let Some(loc) = self.connection_manager.prune_alive_connection(&peer) else {
361361
return;
@@ -473,7 +473,7 @@ impl Ring {
473473
.map(|(loc, conns)| {
474474
let conns: Vec<_> = conns
475475
.iter()
476-
.filter(|conn| !live_tx_tracker.has_live_connection(&conn.location.peer()))
476+
.filter(|conn| !live_tx_tracker.has_live_connection(conn.location.addr()))
477477
.cloned()
478478
.collect();
479479
(*loc, conns)
@@ -653,7 +653,7 @@ impl Ring {
653653
op_manager.connect_forward_estimator.clone(),
654654
);
655655

656-
live_tx_tracker.add_transaction(query_target.peer().clone(), tx);
656+
live_tx_tracker.add_transaction(query_target.addr(), tx);
657657
op_manager
658658
.push(tx, OpEnum::Connect(Box::new(op)))
659659
.await

0 commit comments

Comments
 (0)