Skip to content

Commit

Permalink
Throw error if builder is not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Sep 23, 2023
1 parent cd51df0 commit 2574fad
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/beacon-node/src/api/impl/validator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,10 @@ export function getValidatorApi({
},

async registerValidator(registrations) {
if (!chain.executionBuilder) {
throw Error("Execution builder not enabled");
}

// should only send active or pending validator to builder
// Spec: https://ethereum.github.io/builder-specs/#/Builder/registerValidator
const headState = chain.getHeadState();
Expand All @@ -838,12 +842,11 @@ export function getValidatorApi({
);
});

if (chain.executionBuilder) {
await chain.executionBuilder.registerValidator(filteredRegistrations);
logger.debug("Submitted validator registrations to builder", {
count: filteredRegistrations.length,
});
}
await chain.executionBuilder.registerValidator(filteredRegistrations);

logger.debug("Submitted validator registrations to builder", {
count: filteredRegistrations.length,
});
},
};
}

0 comments on commit 2574fad

Please sign in to comment.