Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
small change
Browse files Browse the repository at this point in the history
  • Loading branch information
igorcrevar committed Oct 12, 2023
1 parent dfcd622 commit 72a803a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
4 changes: 1 addition & 3 deletions forkmanager/fork.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type HandlerDesc string

// HandlerContainer keeps id of a handler and actual handler
type HandlerContainer struct {
// ID is ID of a handler
// ID represents an auto-incremented identifier for a handler
ID uint
// Handler represents an actual event handler
Handler interface{}
Expand Down Expand Up @@ -76,8 +76,6 @@ type forkHandler struct {

// forkParamsBlock encapsulates block and actual fork params
type forkParamsBlock struct {
// id - if two params start from the same block number, the one with the greater ID should take precedence.
id uint
// fromBlockNumber defines block number after params should be active
fromBlockNumber uint64
// params is a pointer to fork params
Expand Down
8 changes: 4 additions & 4 deletions forkmanager/fork_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ type forkManager struct {
forkMap map[string]*Fork
handlersMap map[HandlerDesc][]forkHandler
params []forkParamsBlock
handlersIds map[HandlerDesc]uint

handlerIdCnt uint

Check failure on line 22 in forkmanager/fork_manager.go

View workflow job for this annotation

GitHub Actions / golangci_lint

ST1003: struct field handlerIdCnt should be handlerIDCnt (stylecheck)
}

// GeInstance returns fork manager singleton instance. Thread safe
Expand All @@ -40,7 +41,6 @@ func (fm *forkManager) Clear() {

fm.forkMap = map[string]*Fork{}
fm.handlersMap = map[HandlerDesc][]forkHandler{}
fm.handlersIds = map[HandlerDesc]uint{}
}

// RegisterFork registers fork by its name
Expand All @@ -67,10 +67,10 @@ func (fm *forkManager) RegisterHandler(forkName string, handlerName HandlerDesc,
return fmt.Errorf("fork does not exist: %s", forkName)
}

fm.handlersIds[handlerName]++
fm.handlerIdCnt++

fork.Handlers[handlerName] = HandlerContainer{
ID: fm.handlersIds[handlerName],
ID: fm.handlerIdCnt,
Handler: handler,
}

Expand Down
3 changes: 0 additions & 3 deletions forkmanager/fork_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ func TestForkManager_Deactivate(t *testing.T) {
forkManager := &forkManager{
forkMap: map[string]*Fork{},
handlersMap: map[HandlerDesc][]forkHandler{},
handlersIds: map[HandlerDesc]uint{},
}
mvs1, mvs2 := uint64(1), uint64(2)

Expand Down Expand Up @@ -262,7 +261,6 @@ func TestForkManager_HandlerReplacement(t *testing.T) {
forkManager := &forkManager{
forkMap: map[string]*Fork{},
handlersMap: map[HandlerDesc][]forkHandler{},
handlersIds: map[HandlerDesc]uint{},
}

execute := func(name HandlerDesc, block uint64) string {
Expand Down Expand Up @@ -300,7 +298,6 @@ func TestForkManager_HandlerPrecedence(t *testing.T) {
forkManager := &forkManager{
forkMap: map[string]*Fork{},
handlersMap: map[HandlerDesc][]forkHandler{},
handlersIds: map[HandlerDesc]uint{},
}

execute := func(name HandlerDesc, block uint64) string {
Expand Down

0 comments on commit 72a803a

Please sign in to comment.