Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
network subscribes to fullnode topics declared in config
  • Loading branch information
ong-jonas committed Oct 10, 2023
commit 47046eac1d529a137f116c2743ab83ba42ce7160
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ pub(crate) struct Config {
pub kademlia_protocol_names: Vec<String>,
}

fn fullnode_topics(public_address: PublicAddress) -> Vec<Topic> {
pub(crate) fn fullnode_topics(public_address: PublicAddress) -> Vec<Topic> {
vec![Topic::HotStuffRsBroadcast, Topic::HotStuffRsSend(public_address).into(), Topic::Mempool, Topic::DroppedTxns]
}
3 changes: 2 additions & 1 deletion src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ use std::time::Duration;

use crate::{
behaviour::{Behaviour, PeerNetworkEvent},
config,
messages::{Envelope, Topic},
peer::{EngineCommand, PeerBuilder, Peer}, conversions,
};
Expand Down Expand Up @@ -89,7 +90,7 @@ pub(crate) async fn start(

// 3. Subscribe to Topic
//TODO jonas
swarm.behaviour_mut().subscribe()?;
swarm.behaviour_mut().subscribe(config::fullnode_topics(local_public_address))?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think all applications that uses pchain_network will always subscribe to all topics. For example, fullnode doesn't subscribe to droppedTx. So the topics to be subscribed should be based on the Config we passed in.


// 4. Start p2p networking
let (sender, mut receiver) =
Expand Down