Skip to content

Commit

Permalink
Remove unused AcceptorTracker struct (#2508)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhrubabasu authored Dec 19, 2023
1 parent 7a9bdad commit 6c64372
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions snow/acceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (

var (
_ Acceptor = noOpAcceptor{}
_ Acceptor = (*AcceptorTracker)(nil)
_ Acceptor = acceptorWrapper{}

_ AcceptorGroup = (*acceptorGroup)(nil)
Expand All @@ -38,33 +37,6 @@ func (noOpAcceptor) Accept(*ConsensusContext, ids.ID, []byte) error {
return nil
}

// AcceptorTracker tracks the dispatched accept events by its ID and counts.
// Useful for testing.
type AcceptorTracker struct {
lock sync.RWMutex
accepted map[ids.ID]int
}

func NewAcceptorTracker() *AcceptorTracker {
return &AcceptorTracker{
accepted: make(map[ids.ID]int),
}
}

func (a *AcceptorTracker) Accept(_ *ConsensusContext, containerID ids.ID, _ []byte) error {
a.lock.Lock()
a.accepted[containerID]++
a.lock.Unlock()
return nil
}

func (a *AcceptorTracker) IsAccepted(containerID ids.ID) (int, bool) {
a.lock.RLock()
count, ok := a.accepted[containerID]
a.lock.RUnlock()
return count, ok
}

type acceptorWrapper struct {
Acceptor

Expand Down

0 comments on commit 6c64372

Please sign in to comment.