Skip to content

Commit

Permalink
[p2p] Remove unused inbox code
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed May 17, 2023
1 parent 5ffebc6 commit d069c17
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions p2p/src/fsm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ pub use peermgr::Event as PeerEvent;
pub use pingmgr::Event as PingEvent;
pub use syncmgr::Event as ChainEvent;

use crate::stream;

pub use event::Event;
pub use nakamoto_net::Link;
pub use output::Io;

use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
use std::collections::HashSet;
use std::fmt::{self, Debug};
use std::net;
use std::ops::{Bound, RangeInclusive};
Expand Down Expand Up @@ -80,9 +78,6 @@ pub const MIN_PROTOCOL_VERSION: u32 = 70012;
/// User agent included in `version` messages.
pub const USER_AGENT: &str = "/nakamoto:0.3.0/";

/// Starting size of peer inbox buffer.
const INBOX_BUFFER_SIZE: usize = 1024 * 64;

/// Block locators. Consists of starting hashes and a stop hash.
type Locators = (Vec<BlockHash>, BlockHash);

Expand Down Expand Up @@ -364,8 +359,6 @@ pub struct StateMachine<T, F, P, C> {
tree: T,
/// Bitcoin network we're connecting to.
network: network::Network,
/// Peer message inboxes.
inbox: HashMap<PeerId, stream::Decoder>,
/// Peer address manager.
addrmgr: AddressManager<P, Outbox, C>,
/// Blockchain synchronization manager.
Expand Down Expand Up @@ -520,7 +513,6 @@ impl<T: BlockTree, F: Filters, P: peer::Store, C: AdjustedClock<PeerId>> StateMa
} = config;

let outbox = Outbox::new(network, protocol_version);
let inbox = HashMap::new();
let syncmgr = SyncManager::new(
syncmgr::Config {
max_message_headers: syncmgr::MAX_MESSAGE_HEADERS,
Expand Down Expand Up @@ -578,7 +570,6 @@ impl<T: BlockTree, F: Filters, P: peer::Store, C: AdjustedClock<PeerId>> StateMa
tree,
network,
clock,
inbox,
addrmgr,
syncmgr,
pingmgr,
Expand Down Expand Up @@ -982,8 +973,6 @@ impl<T: BlockTree, F: Filters, P: peer::Store, C: AdjustedClock<PeerId>> traits:
self.addrmgr.record_local_address(*local_addr);
self.addrmgr.peer_connected(&addr);
self.peermgr.peer_connected(addr, *local_addr, link, height);
self.inbox
.insert(addr, stream::Decoder::new(INBOX_BUFFER_SIZE));
}

fn disconnected(
Expand Down

0 comments on commit d069c17

Please sign in to comment.