diff --git a/core/eth/state.go b/core/eth/state.go index 832200b513..a6c7aed1f1 100644 --- a/core/eth/state.go +++ b/core/eth/state.go @@ -23,12 +23,12 @@ func NewChainState(tx core.Transactor, client common.EthClient) *ChainState { var _ core.ChainState = (*ChainState)(nil) func (cs *ChainState) GetOperatorStateByOperator(ctx context.Context, blockNumber uint, operator core.OperatorID) (*core.OperatorState, error) { - operatorsByQuorum, quorumIds, err := cs.Tx.GetOperatorStakes(ctx, operator, uint32(blockNumber)) + operatorsByQuorum, _, err := cs.Tx.GetOperatorStakes(ctx, operator, uint32(blockNumber)) if err != nil { return nil, err } - return getOperatorState(operatorsByQuorum, quorumIds, uint32(blockNumber)) + return getOperatorState(operatorsByQuorum, uint32(blockNumber)) } @@ -38,7 +38,7 @@ func (cs *ChainState) GetOperatorState(ctx context.Context, blockNumber uint, qu return nil, err } - return getOperatorState(operatorsByQuorum, quorums, uint32(blockNumber)) + return getOperatorState(operatorsByQuorum, uint32(blockNumber)) } func (cs *ChainState) GetCurrentBlockNumber() (uint, error) { @@ -51,7 +51,7 @@ func (cs *ChainState) GetCurrentBlockNumber() (uint, error) { return uint(header.Number.Uint64()), nil } -func getOperatorState(operatorsByQuorum core.OperatorStakes, quorumIds []core.QuorumID, blockNumber uint32) (*core.OperatorState, error) { +func getOperatorState(operatorsByQuorum core.OperatorStakes, blockNumber uint32) (*core.OperatorState, error) { operators := make(map[core.QuorumID]map[core.OperatorID]*core.OperatorInfo) totals := make(map[core.QuorumID]*core.OperatorInfo) diff --git a/core/eth/tx.go b/core/eth/tx.go index 6d0ca755b8..c33fa41c83 100644 --- a/core/eth/tx.go +++ b/core/eth/tx.go @@ -370,9 +370,11 @@ func (t *Transactor) GetOperatorStakes(ctx context.Context, operator core.Operat return nil, nil, err } + quorumIds := BitmapToQuorumIds(quorumBitmap) + state := make(core.OperatorStakes, len(state_)) for i := range state_ { - quorumID := core.QuorumID(i) + quorumID := quorumIds[i] state[quorumID] = make(map[core.OperatorIndex]core.OperatorStake, len(state_[i])) for j, op := range state_[i] { operatorIndex := core.OperatorIndex(j) @@ -383,8 +385,6 @@ func (t *Transactor) GetOperatorStakes(ctx context.Context, operator core.Operat } } - quorumIds := BitmapToQuorumIds(quorumBitmap) - return state, quorumIds, nil }