Struct bitcoin_addrman::AddrInfo
source · pub struct AddrInfo {
pub address: Address,
pub n_last_try: i64,
pub n_last_count_attempt: i64,
pub source: NetAddr,
pub n_last_success: i64,
pub n_attempts: i32,
pub n_ref_count: i32,
pub in_tried: bool,
pub n_random_pos: RefCell<i32>,
}
Expand description
| Extended statistics about a CAddress |
Fields§
§address: Address
§n_last_try: i64
| last try whatsoever by us (memory only) |
n_last_count_attempt: i64
| last counted attempt (memory only) |
source: NetAddr
| where knowledge about this address | first came from |
n_last_success: i64
| last successful connection by us |
n_attempts: i32
| connection attempts since last successful | attempt |
n_ref_count: i32
| reference count in new sets (memory | only) |
in_tried: bool
| in tried set? (memory only) |
n_random_pos: RefCell<i32>
| position in vRandom |
Implementations§
source§impl AddrInfo
impl AddrInfo
pub fn new(addr_in: Address, addr_source: NetAddr) -> Self
sourcepub fn get_new_bucket(&self, n_key: &u256, asmap: &Vec<bool>) -> i32
pub fn get_new_bucket(&self, n_key: &u256, asmap: &Vec<bool>) -> i32
| Calculate in which “new” bucket this | entry belongs, using its default source |
sourcepub fn get_tried_bucket(&self, n_key: &u256, asmap: &Vec<bool>) -> i32
pub fn get_tried_bucket(&self, n_key: &u256, asmap: &Vec<bool>) -> i32
| Calculate in which “tried” bucket this | entry belongs |
sourcepub fn get_new_bucket_given_source(
&self,
n_key: &u256,
src: &NetAddr,
asmap: &Vec<bool>
) -> i32
pub fn get_new_bucket_given_source( &self, n_key: &u256, src: &NetAddr, asmap: &Vec<bool> ) -> i32
| Calculate in which “new” bucket this | entry belongs, given a certain source |
sourcepub fn get_bucket_position(
&self,
n_key: &u256,
f_new: bool,
n_bucket: usize
) -> i32
pub fn get_bucket_position( &self, n_key: &u256, f_new: bool, n_bucket: usize ) -> i32
| Calculate in which position of a bucket | to store this entry. |
sourcepub fn is_terrible(&self, n_now: Option<i64>) -> bool
pub fn is_terrible(&self, n_now: Option<i64>) -> bool
| Determine whether the statistics about | this entry are bad enough so that it can | just be deleted |
sourcepub fn get_chance(&self, n_now: Option<i64>) -> f64
pub fn get_chance(&self, n_now: Option<i64>) -> f64
| Calculate the relative chance this | entry should be given when selecting | nodes to connect to |