-
Notifications
You must be signed in to change notification settings - Fork 29
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
Tests for new peer discovery when the tip is stale #1292
Conversation
async fn obtain_addresses(&self) -> Vec<SocketAddress> { | ||
let dns_seed = match self.chain_config.chain_type() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: the logic in this function is not new; it was moved here from reload_dns_seed
p2p/src/peer_manager/mod.rs
Outdated
// This will be called at the end of "heartbeat" function. | ||
fn on_heartbeat(&mut self); | ||
// This will be called for both incoming and outgoing connections. | ||
fn on_connection_acccepted(&mut self, address: SocketAddress); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: I ended up not needing these functions in the final implementation of the tests; but I decided to keep them (and the corresponding PeerManagerNotification
variants), because they may become useful in the future.
…NewLocalTip with NewChainstateTip, which is produced unconditionally.
Making the tests work required some changes in production code as well:
last_tip_block_time
toPeerManager
, which is now used to force a call toreload_dns_seed
.Also, I had to add
PeerManagerEvent::NewLocalTip
, so that the peer manager could learn about locally-produced tips too. This in turn required to addBlockSource
toChainstateEvent::NewTip
.reload_dns_seed
was moved toDefaultDnsSeed::obtain_addresses
.