Skip to content

Commit 1a1bb09

Browse files
fix: test-compressed_validators_diff
1 parent f04a932 commit 1a1bb09

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

beacon_node/store/src/hdiff.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -559,35 +559,36 @@ impl ValidatorsDiff {
559559
.map_err(|_| Error::BalancesIncompleteChunk)?;
560560

561561
if let Some(x_arc) = xs.get_mut(index as usize) {
562-
let mut x = (**x_arc).clone();
562+
let mut v = (**x_arc).clone();
563563
// Note: a pubkey change implies index re-use. In that case over-write
564564
// withdrawal_credentials and slashed inconditionally as their default values
565565
// are valid values.
566566
let pubkey_changed = diff.pubkey != *EMPTY_PUBKEY;
567567
if pubkey_changed {
568-
x.pubkey = diff.pubkey;
568+
v.pubkey = diff.pubkey;
569569
}
570570
if pubkey_changed || diff.withdrawal_credentials != Hash256::ZERO {
571-
x.withdrawal_credentials = diff.withdrawal_credentials;
571+
v.withdrawal_credentials = diff.withdrawal_credentials;
572572
}
573573
if diff.effective_balance != 0 {
574-
x.effective_balance = x.effective_balance.wrapping_add(diff.effective_balance);
574+
v.effective_balance = v.effective_balance.wrapping_add(diff.effective_balance);
575575
}
576576
if pubkey_changed || diff.slashed {
577-
x.slashed = diff.slashed;
577+
v.slashed = diff.slashed;
578578
}
579579
if diff.activation_eligibility_epoch != Epoch::new(0) {
580-
x.activation_eligibility_epoch = diff.activation_eligibility_epoch;
580+
v.activation_eligibility_epoch = diff.activation_eligibility_epoch;
581581
}
582582
if diff.activation_epoch != Epoch::new(0) {
583-
x.activation_epoch = diff.activation_epoch;
583+
v.activation_epoch = diff.activation_epoch;
584584
}
585585
if diff.exit_epoch != Epoch::new(0) {
586-
x.exit_epoch = diff.exit_epoch;
586+
v.exit_epoch = diff.exit_epoch;
587587
}
588588
if diff.withdrawable_epoch != Epoch::new(0) {
589-
x.withdrawable_epoch = diff.withdrawable_epoch;
589+
v.withdrawable_epoch = diff.withdrawable_epoch;
590590
}
591+
*x_arc = Arc::new(v);
591592
} else {
592593
xs.push(Arc::new(diff))
593594
}
@@ -933,7 +934,6 @@ mod tests {
933934
ys[5] = Arc::new(rand_validator(&mut rng));
934935
ys.push(Arc::new(rand_validator(&mut rng)));
935936
let diff = ValidatorsDiff::compute(&xs, &ys, config).unwrap();
936-
937937
let mut xs_out = xs.clone();
938938
diff.apply(&mut xs_out, config).unwrap();
939939
assert_eq!(xs_out, ys);

0 commit comments

Comments
 (0)