Address Michael's comments

This commit is contained in:
Paul Hauner
2019-11-25 15:11:27 +11:00
parent 6bf73e2b55
commit 65cbf601ae
11 changed files with 42 additions and 54 deletions

View File

@@ -90,16 +90,8 @@ impl DutiesStore {
return InsertOutcome::Invalid;
}
if store.contains_key(&duties.validator_pubkey) {
let validator_map = store.get_mut(&duties.validator_pubkey).expect(
"Store is exclusively locked and this path is guarded to ensure the key exists.",
);
if validator_map.contains_key(&epoch) {
let known_duties = validator_map.get_mut(&epoch).expect(
"Validator map is exclusively mutable and this path is guarded to ensure the key exists.",
);
if let Some(validator_map) = store.get_mut(&duties.validator_pubkey) {
if let Some(known_duties) = validator_map.get_mut(&epoch) {
if *known_duties == duties {
InsertOutcome::Identical
} else {

View File

@@ -202,11 +202,11 @@ impl ValidatorDirectoryBuilder {
let voting_keypair = self
.voting_keypair
.clone()
.ok_or_else(|| "build requires a voting_keypair")?;
.ok_or_else(|| "write_keypair_files requires a voting_keypair")?;
let withdrawal_keypair = self
.withdrawal_keypair
.clone()
.ok_or_else(|| "build requires a withdrawal_keypair")?;
.ok_or_else(|| "write_keypair_files requires a withdrawal_keypair")?;
self.save_keypair(voting_keypair, VOTING_KEY_PREFIX)?;
self.save_keypair(withdrawal_keypair, WITHDRAWAL_KEY_PREFIX)?;