Documentation
¶
Index ¶
Constants ¶
const (
ChainIDSeiHardForkTest = "sei-hard-fork-test"
)
Chain-ID constants for use in hard fork handlers.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HardForkHandler ¶
type HardForkHandler interface {
// a unique identifying name to ensure no duplicate handlers are registered
GetName() string
// The target chain ID for which to run this handler (which chain to run on)
GetTargetChainID() string
// The target height at which the handler should be executed
GetTargetHeight() int64
// An execution function used to process a hard fork handler
ExecuteHandler(ctx sdk.Context) error
}
type HardForkManager ¶
type HardForkManager struct {
// contains filtered or unexported fields
}
func NewHardForkManager ¶
func NewHardForkManager(chainID string) *HardForkManager
Create a new hard fork manager for a given chain ID. This will filter out any handlers for other chain IDs, and create a map that maps between target height and handlers to run for the given heights.
func (*HardForkManager) ExecuteForTargetHeight ¶
func (hfm *HardForkManager) ExecuteForTargetHeight(ctx sdk.Context)
This executes the hard fork handlers for the current height. This will function will panic upon receiving an error during hard fork handler execution
func (*HardForkManager) RegisterHandler ¶
func (hfm *HardForkManager) RegisterHandler(handler HardForkHandler)
This tries to register a handler with the hard fork manager. If the handler's target chain ID doesn't match the chain ID of the manager, this is a no-op and the handler is ignored.
func (*HardForkManager) TargetHeightReached ¶
func (hfm *HardForkManager) TargetHeightReached(ctx sdk.Context) bool
This returns a boolean indicating whether or not the current height is a target height for which there are hard fork handlers to run.