makes crds fields private (#13703)

Crds fields should maintain several invariants between themselves, so
exposing them as public fields can be bug prone. In addition these
invariants are asserted on every write:
https://github.com/solana-labs/solana/blob/9668dd85d/core/src/crds.rs#L138-L154
https://github.com/solana-labs/solana/blob/9668dd85d/core/src/crds.rs#L239-L262
which adds extra instructions and is not optimal. Should these fields be
private the asserts will be redundant.
This commit is contained in:
behzad nouri
2020-11-19 20:57:40 +00:00
committed by GitHub
parent 397cf726fc
commit b58f69297f
5 changed files with 57 additions and 36 deletions

View File

@@ -498,7 +498,7 @@ fn network_run_pull(
}
let total: usize = network_values
.par_iter()
.map(|v| v.lock().unwrap().crds.table.len())
.map(|v| v.lock().unwrap().crds.len())
.sum();
convergance = total as f64 / ((num * num) as f64);
if convergance > max_convergance {