Skip to content

Commit

Permalink
patches bug causing false duplicate nodes error (#2666)
Browse files Browse the repository at this point in the history
The bootstrap code during the validator start pushes a contact-info with
more recent timestamp to gossip. If the node is staked the contact-info
lingers in gossip causing false duplicate node instances when the fully
initialized node joins gossip later on.

The commit refreshes the timestamp on contact-info so that it overrides
the one pushed by bootstrap and avoid false duplicates error.
  • Loading branch information
behzadnouri authored Aug 20, 2024
1 parent 951bb04 commit 6a34b3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gossip/src/contact_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ impl ContactInfo {
&self.version
}

pub(crate) fn hot_swap_pubkey(&mut self, pubkey: Pubkey) {
pub fn hot_swap_pubkey(&mut self, pubkey: Pubkey) {
self.pubkey = pubkey;
// Need to update ContactInfo.outset so that this node's contact-info
// will override older node with the same pubkey.
Expand Down
7 changes: 7 additions & 0 deletions validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2038,6 +2038,13 @@ pub fn main() {
return;
}

// Bootstrap code above pushes a contact-info with more recent timestamp to
// gossip. If the node is staked the contact-info lingers in gossip causing
// false duplicate nodes error.
// Below line refreshes the timestamp on contact-info so that it overrides
// the one pushed by bootstrap.
node.info.hot_swap_pubkey(identity_keypair.pubkey());

let validator = Validator::new(
node,
identity_keypair,
Expand Down

0 comments on commit 6a34b3e

Please sign in to comment.