Skip to content

Commit a243ee0

Browse files
committed
fix: test
1 parent 3dfc555 commit a243ee0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/consensus/parlia/tests/validator_tests.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ fn test_snapshot_with_validators() {
5151
expected_validators.sort();
5252
assert_eq!(snapshot.validators, expected_validators);
5353

54-
// Check validator map entries - when vote_addrs is None, ValidatorInfo uses Default
55-
// which sets index=0 and vote_addr=VoteAddress::default()
56-
for validator in expected_validators.iter() {
54+
// Check validator map entries - when vote_addrs is None, indices are 1-based
55+
// Index is based on sorted position: 1, 2, 3, ...
56+
for (idx, validator) in expected_validators.iter().enumerate() {
5757
let info = snapshot.validators_map.get(validator).unwrap();
58-
// When no vote_addrs provided, Default::default() is used which has index=0
59-
assert_eq!(info.index, 0);
60-
assert_eq!(info.vote_addr, VoteAddress::default());
58+
// When no vote_addrs provided, indices are assigned as (sorted_position + 1)
59+
assert_eq!(info.index, (idx + 1) as u64);
60+
assert_eq!(info.vote_addr, VoteAddress::ZERO);
6161
}
6262
}
6363

0 commit comments

Comments
 (0)