MCPcopy Create free account
hub / github.com/consensus-shipyard/ipc / get_validator_weight

Method get_validator_weight

ipc/api/src/runtime.rs:12–21  ·  view source on GitHub ↗

Get the weight of a validator It expects ID addresses as an input

(&self, rt: &impl Runtime, addr: &Address)

Source from the content-addressed store, hash-verified

10 /// Get the weight of a validator
11 /// It expects ID addresses as an input
12 pub fn get_validator_weight(&self, rt: &impl Runtime, addr: &Address) -> Option<TokenAmount> {
13 self.validators
14 .validators()
15 .iter()
16 .find(|x| match rt.resolve_address(&x.addr) {
17 Some(id) => id == *addr,
18 None => false,
19 })
20 .map(|v| v.weight.clone())
21 }
22}

Callers

nothing calls this directly

Calls 2

resolve_addressMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected