@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
32 lines • 1.75 kB
JavaScript
import { VoluntaryExitValidity } from "@lodestar/state-transition";
import { GossipActionError } from "./gossipValidation.js";
export { VoluntaryExitErrorCode };
var VoluntaryExitErrorCode;
(function (VoluntaryExitErrorCode) {
VoluntaryExitErrorCode["ALREADY_EXISTS"] = "VOLUNTARY_EXIT_ERROR_ALREADY_EXISTS";
VoluntaryExitErrorCode["INACTIVE"] = "VOLUNTARY_EXIT_ERROR_INACTIVE";
VoluntaryExitErrorCode["ALREADY_EXITED"] = "VOLUNTARY_EXIT_ERROR_ALREADY_EXITED";
VoluntaryExitErrorCode["EARLY_EPOCH"] = "VOLUNTARY_EXIT_ERROR_EARLY_EPOCH";
VoluntaryExitErrorCode["SHORT_TIME_ACTIVE"] = "VOLUNTARY_EXIT_ERROR_SHORT_TIME_ACTIVE";
VoluntaryExitErrorCode["PENDING_WITHDRAWALS"] = "VOLUNTARY_EXIT_ERROR_PENDING_WITHDRAWALS";
VoluntaryExitErrorCode["INVALID_SIGNATURE"] = "VOLUNTARY_EXIT_ERROR_INVALID_SIGNATURE";
})(VoluntaryExitErrorCode || (VoluntaryExitErrorCode = {}));
export class VoluntaryExitError extends GossipActionError {
}
export function voluntaryExitValidityToErrorCode(validity) {
switch (validity) {
case VoluntaryExitValidity.inactive:
return VoluntaryExitErrorCode.INACTIVE;
case VoluntaryExitValidity.alreadyExited:
return VoluntaryExitErrorCode.ALREADY_EXITED;
case VoluntaryExitValidity.earlyEpoch:
return VoluntaryExitErrorCode.EARLY_EPOCH;
case VoluntaryExitValidity.shortTimeActive:
return VoluntaryExitErrorCode.SHORT_TIME_ACTIVE;
case VoluntaryExitValidity.pendingWithdrawals:
return VoluntaryExitErrorCode.PENDING_WITHDRAWALS;
case VoluntaryExitValidity.invalidSignature:
return VoluntaryExitErrorCode.INVALID_SIGNATURE;
}
}
//# sourceMappingURL=voluntaryExitError.js.map