diff --git a/testscommon/evictionNotifierStub.go b/testscommon/evictionNotifierStub.go index ee938950..b354e393 100644 --- a/testscommon/evictionNotifierStub.go +++ b/testscommon/evictionNotifierStub.go @@ -3,7 +3,7 @@ package testscommon // EvictionNotifierStub - type EvictionNotifierStub struct { NotifyEvictionCalled func(txHash []byte, cacheId string) - ShouldNotifyEvictionCalled func(txHash []byte) bool + ShouldNotifyEvictionCalled func(txHash []byte, cacheId string) bool } // NotifyEviction - @@ -14,9 +14,9 @@ func (stub *EvictionNotifierStub) NotifyEviction(txHash []byte, cacheId string) } // ShouldNotifyEviction - -func (stub *EvictionNotifierStub) ShouldNotifyEviction(txHash []byte) bool { +func (stub *EvictionNotifierStub) ShouldNotifyEviction(txHash []byte, cacheId string) bool { if stub.ShouldNotifyEvictionCalled != nil { - return stub.ShouldNotifyEvictionCalled(txHash) + return stub.ShouldNotifyEvictionCalled(txHash, cacheId) } return false } diff --git a/txcache/baseTxCache.go b/txcache/baseTxCache.go index 309b0cfc..733ed19b 100644 --- a/txcache/baseTxCache.go +++ b/txcache/baseTxCache.go @@ -44,7 +44,7 @@ func (cache *baseTxCache) enqueueEvictedHashesForNotification(txHashes [][]byte) for _, handler := range handlers { for _, txHash := range txHashes { - if !handler.ShouldNotifyEviction(txHash) { + if !handler.ShouldNotifyEviction(txHash, cache.name) { continue } diff --git a/txcache/crossTxCache_test.go b/txcache/crossTxCache_test.go index c43b8734..e5d99f85 100644 --- a/txcache/crossTxCache_test.go +++ b/txcache/crossTxCache_test.go @@ -80,7 +80,7 @@ func TestCrossTxCache_RegisterEvictionHandler(t *testing.T) { require.True(t, bytes.Equal([]byte("hash-1"), hash)) ch <- struct{}{} }, - ShouldNotifyEvictionCalled: func(txHash []byte) bool { + ShouldNotifyEvictionCalled: func(txHash []byte, cacheId string) bool { return true }, }) diff --git a/txcache/txCache_test.go b/txcache/txCache_test.go index ce277a96..4e92b1bc 100644 --- a/txcache/txCache_test.go +++ b/txcache/txCache_test.go @@ -559,7 +559,7 @@ func TestTxCache_NoCriticalInconsistency_WhenConcurrentAdditionsAndRemovals(t *t atomic.AddUint32(&handlerCalls, 1) evictionHandlerWG.Done() }, - ShouldNotifyEvictionCalled: func(txHash []byte) bool { + ShouldNotifyEvictionCalled: func(txHash []byte, cacheId string) bool { return true }, }) @@ -671,7 +671,7 @@ func TestTxCache_RegisterEvictionHandler(t *testing.T) { require.True(t, bytes.Equal([]byte("hash-1"), hash) || bytes.Equal([]byte("hash-2"), hash)) ch <- atomic.LoadUint32(&cnt) }, - ShouldNotifyEvictionCalled: func(txHash []byte) bool { + ShouldNotifyEvictionCalled: func(txHash []byte, cacheId string) bool { return true }, }) diff --git a/types/interface.go b/types/interface.go index a001227e..67a913ef 100644 --- a/types/interface.go +++ b/types/interface.go @@ -234,6 +234,6 @@ type PersisterCreator interface { // EvictionNotifier defines the behaviour of a component which is able to handle an evicted transaction type EvictionNotifier interface { NotifyEviction(txHash []byte, cacheId string) - ShouldNotifyEviction(txHash []byte) bool + ShouldNotifyEviction(txHash []byte, cacheId string) bool IsInterfaceNil() bool }