|
|
@@ -181,11 +181,7 @@ impl ContactInfo {
|
|
|
Self {
|
|
|
pubkey,
|
|
|
wallclock,
|
|
|
- outset: {
|
|
|
- let now = SystemTime::now();
|
|
|
- let elapsed = now.duration_since(UNIX_EPOCH).unwrap();
|
|
|
- u64::try_from(elapsed.as_micros()).unwrap()
|
|
|
- },
|
|
|
+ outset: get_node_outset(),
|
|
|
shred_version,
|
|
|
version: solana_version::Version::default(),
|
|
|
addrs: Vec::<IpAddr>::default(),
|
|
|
@@ -210,8 +206,11 @@ impl ContactInfo {
|
|
|
self.shred_version
|
|
|
}
|
|
|
|
|
|
- pub fn set_pubkey(&mut self, pubkey: Pubkey) {
|
|
|
- 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.
|
|
|
+ self.outset = get_node_outset();
|
|
|
}
|
|
|
|
|
|
pub fn set_wallclock(&mut self, wallclock: u64) {
|
|
|
@@ -409,6 +408,12 @@ impl ContactInfo {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+fn get_node_outset() -> u64 {
|
|
|
+ let now = SystemTime::now();
|
|
|
+ let elapsed = now.duration_since(UNIX_EPOCH).unwrap();
|
|
|
+ u64::try_from(elapsed.as_micros()).unwrap()
|
|
|
+}
|
|
|
+
|
|
|
impl<'de> Deserialize<'de> for ContactInfo {
|
|
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
|
|
where
|