Skip to content

Commit a9e688c

Browse files
committed
Add top level conf VALIDATOR_RECORD_ACTIVE_STATUSES to avoid runtime overhead
1 parent 9704e17 commit a9e688c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

eth/beacon/types/validator_records.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
)
1414

1515

16+
VALIDATOR_RECORD_ACTIVE_STATUSES = {
17+
ValidatorStatusCode.ACTIVE,
18+
ValidatorStatusCode.ACTIVE_PENDING_EXIT,
19+
}
20+
21+
1622
class ValidatorRecord(rlp.Serializable):
1723
"""
1824
Note: using RLP until we have standardized serialization format.
@@ -61,7 +67,4 @@ def is_active(self) -> bool:
6167
"""
6268
Returns ``True`` if the validator is active.
6369
"""
64-
return self.status in [
65-
ValidatorStatusCode.ACTIVE,
66-
ValidatorStatusCode.ACTIVE_PENDING_EXIT
67-
]
70+
return self.status in VALIDATOR_RECORD_ACTIVE_STATUSES

0 commit comments

Comments
 (0)