Skip to content

Commit

Permalink
core/scheduler: add support for duty builder proposer (#827)
Browse files Browse the repository at this point in the history
- scheduler implementation for builder proposer

category: feature
ticket: #809
  • Loading branch information
ciaranmcveigh5 authored Jul 21, 2022
1 parent 6581ca0 commit 0f996c2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func New(pubkeys []core.PubKey, eth2Svc eth2client.Service) (*Scheduler, error)
return time.After(time.Until(deadline))
},
resolvedEpoch: math.MaxUint64,
builderAPI: false,
}, nil
}

Expand All @@ -93,6 +94,7 @@ type Scheduler struct {
duties map[core.Duty]core.DutyDefinitionSet
dutiesMutex sync.Mutex
subs []func(context.Context, core.Duty, core.DutyDefinitionSet) error
builderAPI bool
}

// Subscribe registers a callback for triggering a duty.
Expand Down Expand Up @@ -317,7 +319,13 @@ func (s *Scheduler) resolveProDuties(ctx context.Context, slot slot, vals valida
continue
}

duty := core.Duty{Slot: int64(proDuty.Slot), Type: core.DutyProposer}
var duty core.Duty

if s.builderAPI {
duty = core.Duty{Slot: int64(proDuty.Slot), Type: core.DutyBuilderProposer}
} else {
duty = core.Duty{Slot: int64(proDuty.Slot), Type: core.DutyProposer}
}

pubkey, ok := vals.PubKeyFromIndex(proDuty.ValidatorIndex)
if !ok {
Expand Down

0 comments on commit 0f996c2

Please sign in to comment.