Skip to content

Commit

Permalink
tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
igorcrevar committed Jun 1, 2023
1 parent 5dd3777 commit 592dbf8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 7 additions & 0 deletions consensus/polybft/extra_fork_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ import (
"github.com/umbracle/fastrlp"
)

func init() {
// for tests
forkManagerInstance.RegisterFork(forkmanager.InitialFork)
_ = forkManagerInstance.RegisterHandler(forkmanager.InitialFork, extraHandler, &ExtraHandlerBase{})
_ = forkManagerInstance.ActivateFork(forkmanager.InitialFork, 0)
}

const extraHandler forkmanager.HandlerDesc = "extra"

type IExtraHandler interface {
Expand Down
12 changes: 8 additions & 4 deletions consensus/polybft/polybft.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,15 @@ func ForkManagerFactory(forks *chain.Forks) error {
fm := forkmanager.GetInstance()

// Register handlers here
_ = fm.RegisterHandler(forkmanager.InitialFork, extraHandler, &ExtraHandlerBase{})
_ = fm.RegisterHandler(chain.MyFirstFork, extraHandler, &ExtraHandlerMyFirstFork{})
_ = fm.RegisterHandler(chain.MySecondFork, extraHandler, &ExtraHandlerMySecondFork{})
if err := fm.RegisterHandler(forkmanager.InitialFork, extraHandler, &ExtraHandlerBase{}); err != nil {
return err
}

return nil
if err := fm.RegisterHandler(chain.MyFirstFork, extraHandler, &ExtraHandlerMyFirstFork{}); err != nil {
return err
}

return fm.RegisterHandler(chain.MySecondFork, extraHandler, &ExtraHandlerMySecondFork{})
}

// Initialize initializes the consensus (e.g. setup data)
Expand Down

0 comments on commit 592dbf8

Please sign in to comment.