update peer status from announcement

This commit is contained in:
Robert Habermeier 2016-12-28 16:20:35 +01:00
parent c2ad769fb7
commit 5309ba45a8
1 changed files with 10 additions and 0 deletions

View File

@ -158,6 +158,16 @@ pub struct Status {
pub last_head: Option<(H256, u64)>,
}
impl Status {
/// Update the status from an announcement.
pub fn update_from(&mut self, announcement: &Announcement) {
self.last_head = Some((self.head_hash, announcement.reorg_depth));
self.head_td = announcement.head_td;
self.head_hash = announcement.head_hash;
self.head_num = announcement.head_num;
}
}
/// Peer capabilities.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Capabilities {