Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node: rm fields #58

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/node/peer_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ impl PeerMap {
self.num_peers = peer_num;
let mut peer = Peer::new(
peer_num,
ip.clone(),
port,
self.network,
self.mtx.clone(),
prx,
Expand All @@ -157,11 +155,11 @@ impl PeerMap {
if !connector.can_connect(&ip) {
return Err(PeerError::UnreachableSocketAddr);
}
let (reader, writer) = connector.connect(ip.clone(), port).await?;
let handle = tokio::spawn(async move { peer.run(reader, writer).await });
self.dialog
.send_dialog(format!("Connecting to {:?}:{}", ip, port))
.await;
let (reader, writer) = connector.connect(ip.clone(), port).await?;
let handle = tokio::spawn(async move { peer.run(reader, writer).await });
self.map.insert(
peer_num,
ManagedPeer {
Expand Down
8 changes: 1 addition & 7 deletions src/peers/peer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extern crate tokio;
use std::time::Duration;

use bitcoin::{p2p::address::AddrV2, Network};
use bitcoin::Network;
use tokio::{
io::{AsyncRead, AsyncWrite, AsyncWriteExt},
select,
Expand All @@ -28,8 +28,6 @@ const CONNECTION_TIMEOUT: u64 = 2;

pub(crate) struct Peer {
nonce: u32,
ip_addr: AddrV2,
port: u16,
main_thread_sender: Sender<PeerThreadMessage>,
main_thread_recv: Receiver<MainThreadMessage>,
network: Network,
Expand All @@ -41,8 +39,6 @@ pub(crate) struct Peer {
impl Peer {
pub fn new(
nonce: u32,
ip_addr: AddrV2,
port: u16,
network: Network,
main_thread_sender: Sender<PeerThreadMessage>,
main_thread_recv: Receiver<MainThreadMessage>,
Expand All @@ -52,8 +48,6 @@ impl Peer {
let message_timer = MessageTimer::new();
Self {
nonce,
ip_addr,
port,
main_thread_sender,
main_thread_recv,
network,
Expand Down
Loading