Skip to content

Commit

Permalink
refactor: use map instead of array
Browse files Browse the repository at this point in the history
  • Loading branch information
renlulu committed Aug 28, 2024
1 parent 706d874 commit bc089f6
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions chainio/clients/avsregistry/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ func (r *ChainReader) GetOperatorFromId(
func (r *ChainReader) QueryRegistrationDetail(
opts *bind.CallOpts,
operatorAddress common.Address,
) ([]bool, error) {
) (map[int]bool, error) {
operatorId, err := r.GetOperatorId(opts, operatorAddress)
if err != nil {
return nil, err
Expand All @@ -368,14 +368,9 @@ func (r *ChainReader) QueryRegistrationDetail(
return nil, err
}
numBits := value.BitLen()
quorums := make([]bool, numBits)
quorums := make(map[int]bool, numBits)
for i := 0; i < numBits; i++ {
// Check if the ith bit is set
if value.Int64()&(1<<i) != 0 {
quorums[i] = true
} else {
quorums[i] = false
}
quorums[i] = value.Int64()&(1<<i) != 0
}
return quorums, nil
}
Expand Down

0 comments on commit bc089f6

Please sign in to comment.