Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tx status in mempool #1287

Merged
merged 49 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
473937e
feat: add tx status in mempool
ninabarbakadze Apr 5, 2024
33355a0
refactor: LRUTxCache to take tx key instead of tx
ninabarbakadze Apr 18, 2024
d4a86e3
feat: add the same methods to other mempools to build (wip)
ninabarbakadze Apr 19, 2024
cd28593
chore: fix go sum entry error
ninabarbakadze May 17, 2024
aff84b8
(wip): remove rejected, evicted txs works
ninabarbakadze Jun 5, 2024
4039a56
refactor: tests and functions to make it cleaner
ninabarbakadze Jun 6, 2024
51f2e96
Merge branch 'main' into nina/current-tx-status
ninabarbakadze Jun 6, 2024
6fb9af9
fix: build
ninabarbakadze Jun 6, 2024
2f38c2b
test: more tests
ninabarbakadze Jun 6, 2024
edbcdae
style: lint
ninabarbakadze Jun 6, 2024
652f814
style: cleanup
ninabarbakadze Jun 6, 2024
2cede15
style: lint
ninabarbakadze Jun 6, 2024
125ef6f
style: gofumped
ninabarbakadze Jun 6, 2024
37c8cd1
style: goimports
ninabarbakadze Jun 6, 2024
90f482c
Update mempool/cache.go
ninabarbakadze Jun 11, 2024
5cdd6e0
Update mempool/cache.go
ninabarbakadze Jun 11, 2024
94a4d3d
Update mempool/cache.go
ninabarbakadze Jun 11, 2024
26bbd60
Update mempool/cat/pool.go
ninabarbakadze Jun 11, 2024
7708045
Update mempool/mempool.go
ninabarbakadze Jun 11, 2024
4b8918d
Update mempool/mock/mempool.go
ninabarbakadze Jun 11, 2024
2a07da9
Update mempool/v0/clist_mempool.go
ninabarbakadze Jun 11, 2024
e8e634b
Update mempool/v0/clist_mempool.go
ninabarbakadze Jun 11, 2024
e91c8f1
Update rpc/core/tx_status.go
ninabarbakadze Jun 11, 2024
9bcd19b
Update mempool/v1/mempool.go
ninabarbakadze Jun 11, 2024
c370030
refactor: address review comments
ninabarbakadze Jun 11, 2024
1cbb37d
test: add more consistent comments
ninabarbakadze Jun 11, 2024
a22978d
Update pool.go
ninabarbakadze Jun 11, 2024
33e8bf3
Update mempool.go
ninabarbakadze Jun 11, 2024
709e6d3
Update mempool/v1/mempool.go
ninabarbakadze Jun 12, 2024
39f1deb
Update mempool/v1/mempool.go
ninabarbakadze Jun 12, 2024
2384c48
Merge branch 'main' into nina/current-tx-status
ninabarbakadze Jun 12, 2024
58929bb
Update mempool/cat/pool_test.go
ninabarbakadze Jun 12, 2024
840b61d
Update mempool/cat/pool.go
ninabarbakadze Jun 12, 2024
d21e084
refacotor: address review comments
ninabarbakadze Jun 13, 2024
486888e
Update mempool.go
ninabarbakadze Jun 13, 2024
8a5bbae
refactor: revert mempool cache changes
ninabarbakadze Jun 13, 2024
e4c9839
style: lint
ninabarbakadze Jun 13, 2024
5ae87e9
refactor: comments
ninabarbakadze Jun 13, 2024
6ac1205
refactor: revert accidentally removed comment
ninabarbakadze Jun 13, 2024
4e09a6c
Update mempool/v1/mempool.go
ninabarbakadze Jun 13, 2024
cc8c178
Update mempool/mempool.go
ninabarbakadze Jun 13, 2024
7437fd9
Update mempool/mempool.go
ninabarbakadze Jun 13, 2024
c6f3e9a
test: update test
ninabarbakadze Jun 13, 2024
bc74ef3
refactor: no longer pass the cache in purgeExpiredTxs and reduce evic…
ninabarbakadze Jun 17, 2024
64eb498
feat: add txstatus in mempool and test it
ninabarbakadze Jun 17, 2024
bbcb66a
style: lint
ninabarbakadze Jun 17, 2024
a75c6d5
lint: remove lint error
ninabarbakadze Jun 17, 2024
14d09b0
refactor: rename IsTxEvicted to WasRecentlyEvicted
ninabarbakadze Jun 17, 2024
8e3c51d
Update mempool/cat/store.go
ninabarbakadze Jun 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion consensus/replay_stubs.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (emptyMempool) TxsWaitChan() <-chan struct{} { return nil }
func (emptyMempool) InitWAL() error { return nil }
func (emptyMempool) CloseWAL() {}
func (emptyMempool) GetTxByKey(types.TxKey) (types.Tx, bool) { return nil, false }
func (emptyMempool) IsTxEvicted(types.TxKey) bool { return false }
func (emptyMempool) WasRecentlyEvicted(types.TxKey) bool { return false }

//-----------------------------------------------------------------------------
// mockProxyApp uses ABCIResponses to give the right results.
Expand Down
20 changes: 14 additions & 6 deletions mempool/cat/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func NewTxPool(
proxyAppConn: proxyAppConn,
metrics: mempool.NopMetrics(),
rejectedTxCache: NewLRUTxCache(cfg.CacheSize),
evictedTxCache: NewLRUTxCache(cfg.CacheSize),
evictedTxCache: NewLRUTxCache(cfg.CacheSize / 5),
seenByPeersSet: NewSeenTxSet(),
height: height,
preCheckFn: func(_ types.Tx) error { return nil },
Expand Down Expand Up @@ -190,9 +190,9 @@ func (txmp *TxPool) GetTxByKey(txKey types.TxKey) (types.Tx, bool) {
return types.Tx{}, false
}

// IsTxEvicted returns a bool indicating whether the transaction with
// WasRecentlyEvicted returns a bool indicating whether the transaction with
// the specified key was recently evicted and is currently within the cache.
func (txmp *TxPool) IsTxEvicted(txKey types.TxKey) bool {
func (txmp *TxPool) WasRecentlyEvicted(txKey types.TxKey) bool {
return txmp.evictedTxCache.Has(txKey)
}

Expand All @@ -210,9 +210,13 @@ func (txmp *TxPool) CheckToPurgeExpiredTxs() {
defer txmp.updateMtx.Unlock()
if txmp.config.TTLDuration > 0 && time.Since(txmp.lastPurgeTime) > txmp.config.TTLDuration {
expirationAge := time.Now().Add(-txmp.config.TTLDuration)
// a height of 0 means no transactions will be removed because of height
// A height of 0 means no transactions will be removed because of height
// (in other words, no transaction has a height less than 0)
numExpired := txmp.store.purgeExpiredTxs(0, expirationAge, txmp.evictedTxCache)
purgedTxs, numExpired := txmp.store.purgeExpiredTxs(0, expirationAge)
// Add the purged transactions to the evicted cache
for _, tx := range purgedTxs {
txmp.evictedTxCache.Push(tx.key)
}
txmp.metrics.EvictedTxs.Add(float64(numExpired))
txmp.lastPurgeTime = time.Now()
}
Expand Down Expand Up @@ -738,7 +742,11 @@ func (txmp *TxPool) purgeExpiredTxs(blockHeight int64) {
expirationAge = time.Time{}
}

numExpired := txmp.store.purgeExpiredTxs(expirationHeight, expirationAge, txmp.evictedTxCache)
purgedTxs, numExpired := txmp.store.purgeExpiredTxs(expirationHeight, expirationAge)
// Add the purged transactions to the evicted cache
for _, tx := range purgedTxs {
txmp.evictedTxCache.Push(tx.key)
}
txmp.metrics.EvictedTxs.Add(float64(numExpired))

// purge old evicted and seen transactions
Expand Down
20 changes: 10 additions & 10 deletions mempool/cat/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func TestTxPool_Eviction(t *testing.T) {
mustCheckTx(t, txmp, "key1=0000=25")
require.True(t, txExists("key1=0000=25"))
require.False(t, txExists(bigTx))
require.True(t, txmp.IsTxEvicted(types.Tx(bigTx).Key()))
require.True(t, txmp.WasRecentlyEvicted(types.Tx(bigTx).Key()))
require.Equal(t, int64(len("key1=0000=25")), txmp.SizeBytes())

// Now fill up the rest of the slots with other transactions.
Expand All @@ -258,27 +258,27 @@ func TestTxPool_Eviction(t *testing.T) {
require.Error(t, err)
require.Contains(t, err.Error(), "mempool is full")
require.False(t, txExists("key6=0005=1"))
require.True(t, txmp.IsTxEvicted(types.Tx("key6=0005=1").Key()))
require.True(t, txmp.WasRecentlyEvicted(types.Tx("key6=0005=1").Key()))

// A new transaction with higher priority should evict key5, which is the
// newest of the two transactions with lowest priority.
mustCheckTx(t, txmp, "key7=0006=7")
require.True(t, txExists("key7=0006=7")) // new transaction added
require.False(t, txExists("key5=0004=3")) // newest low-priority tx evicted
require.True(t, txmp.IsTxEvicted(types.Tx("key5=0004=3").Key()))
require.True(t, txmp.WasRecentlyEvicted(types.Tx("key5=0004=3").Key()))
require.True(t, txExists("key4=0003=3")) // older low-priority tx retained

// Another new transaction evicts the other low-priority element.
mustCheckTx(t, txmp, "key8=0007=20")
require.True(t, txExists("key8=0007=20"))
require.False(t, txExists("key4=0003=3"))
require.True(t, txmp.IsTxEvicted(types.Tx("key4=0003=3").Key()))
require.True(t, txmp.WasRecentlyEvicted(types.Tx("key4=0003=3").Key()))

// Now the lowest-priority tx is 5, so that should be the next to go.
mustCheckTx(t, txmp, "key9=0008=9")
require.True(t, txExists("key9=0008=9"))
require.False(t, txExists("key2=0001=5"))
require.True(t, txmp.IsTxEvicted(types.Tx("key2=0001=5").Key()))
require.True(t, txmp.WasRecentlyEvicted(types.Tx("key2=0001=5").Key()))

// Add a transaction that requires eviction of multiple lower-priority
// entries, in order to fit the size of the element.
Expand All @@ -287,11 +287,11 @@ func TestTxPool_Eviction(t *testing.T) {
require.True(t, txExists("key8=0007=20"))
require.True(t, txExists("key10=0123456789abcdef=11"))
require.False(t, txExists("key3=0002=10"))
require.True(t, txmp.IsTxEvicted(types.Tx("key3=0002=10").Key()))
require.True(t, txmp.WasRecentlyEvicted(types.Tx("key3=0002=10").Key()))
require.False(t, txExists("key9=0008=9"))
require.True(t, txmp.IsTxEvicted(types.Tx("key9=0008=9").Key()))
require.True(t, txmp.WasRecentlyEvicted(types.Tx("key9=0008=9").Key()))
require.False(t, txExists("key7=0006=7"))
require.True(t, txmp.IsTxEvicted(types.Tx("key7=0006=7").Key()))
require.True(t, txmp.WasRecentlyEvicted(types.Tx("key7=0006=7").Key()))

// Free up some space so we can add back previously evicted txs
err = txmp.Update(1, types.Txs{types.Tx("key10=0123456789abcdef=11")}, []*abci.ResponseDeliverTx{{Code: abci.CodeTypeOK}}, nil, nil)
Expand All @@ -304,7 +304,7 @@ func TestTxPool_Eviction(t *testing.T) {
// space for the previously evicted tx
require.NoError(t, txmp.RemoveTxByKey(types.Tx("key8=0007=20").Key()))
require.False(t, txExists("key8=0007=20"))
require.False(t, txmp.IsTxEvicted(types.Tx("key8=0007=20").Key()))
require.False(t, txmp.WasRecentlyEvicted(types.Tx("key8=0007=20").Key()))
}

func TestTxPool_Flush(t *testing.T) {
Expand Down Expand Up @@ -577,7 +577,7 @@ func TestTxPool_ExpiredTxs_Timestamp(t *testing.T) {
// All the transactions in the original set should have been purged.
for _, tx := range added1 {
// Check that it was added to the evictedTxCache
evicted := txmp.IsTxEvicted(tx.tx.Key())
evicted := txmp.WasRecentlyEvicted(tx.tx.Key())
require.True(t, evicted)

if txmp.store.has(tx.tx.Key()) {
Expand Down
11 changes: 6 additions & 5 deletions mempool/cat/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,22 @@ func (s *store) getTxsBelowPriority(priority int64) ([]*wrappedTx, int64) {

// purgeExpiredTxs removes all transactions that are older than the given height
// and time. Returns the amount of transactions that were removed
ninabarbakadze marked this conversation as resolved.
Show resolved Hide resolved
func (s *store) purgeExpiredTxs(expirationHeight int64, expirationAge time.Time, evictedTxCache *LRUTxCache) int {
func (s *store) purgeExpiredTxs(expirationHeight int64, expirationAge time.Time) ([]*wrappedTx, int) {
s.mtx.Lock()
defer s.mtx.Unlock()

var purgedTxs []*wrappedTx
counter := 0

for key, tx := range s.txs {
if tx.height < expirationHeight || tx.timestamp.Before(expirationAge) {
s.bytes -= tx.size()
delete(s.txs, key)
if evictedTxCache != nil {
evictedTxCache.Push(key)
}
purgedTxs = append(purgedTxs, tx)
counter++
}
}
return counter
return purgedTxs, counter
}

func (s *store) reset() {
Expand Down
4 changes: 2 additions & 2 deletions mempool/cat/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ func TestStoreExpiredTxs(t *testing.T) {
}

// half of them should get purged
store.purgeExpiredTxs(int64(numTxs/2), time.Time{}, nil)
store.purgeExpiredTxs(int64(numTxs/2), time.Time{})

remainingTxs := store.getAllTxs()
require.Equal(t, numTxs/2, len(remainingTxs))
for _, tx := range remainingTxs {
require.GreaterOrEqual(t, tx.height, int64(numTxs/2))
}

store.purgeExpiredTxs(int64(0), time.Now().Add(time.Second), nil)
store.purgeExpiredTxs(int64(0), time.Now().Add(time.Second))
require.Empty(t, store.getAllTxs())
}
6 changes: 3 additions & 3 deletions mempool/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ type Mempool interface {
// trigger once every height when transactions are available.
EnableTxsAvailable()

// GetTxByKey gets a tx by its key from the mempool cache. Returns the tx and a bool indicating its presence in the tx cache.
// GetTxByKey gets a tx by its key from the mempool. Returns the tx and a bool indicating its presence in the tx cache.
// Used in the RPC endpoint: TxStatus.
GetTxByKey(key types.TxKey) (types.Tx, bool)

// IsTxEvicted returns true if the tx is evicted from the mempool and exists in the
// WasRecentlyEvicted returns true if the tx was evicted from the mempool and exists in the
// evicted cache.
// Used in the RPC endpoint: TxStatus.
IsTxEvicted(key types.TxKey) bool
WasRecentlyEvicted(key types.TxKey) bool

// Size returns the number of transactions in the mempool.
Size() int
Expand Down
2 changes: 1 addition & 1 deletion mempool/mock/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (Mempool) TxsAvailable() <-chan struct{} { return make(chan str
func (Mempool) EnableTxsAvailable() {}
func (Mempool) SizeBytes() int64 { return 0 }
func (m Mempool) GetTxByKey(types.TxKey) (types.Tx, bool) { return nil, false }
func (m Mempool) IsTxEvicted(types.TxKey) bool { return false }
func (m Mempool) WasRecentlyEvicted(types.TxKey) bool { return false }
func (Mempool) TxsFront() *clist.CElement { return nil }
func (Mempool) TxsWaitChan() <-chan struct{} { return nil }

Expand Down
13 changes: 9 additions & 4 deletions mempool/v0/clist_mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,18 @@ func (mem *CListMempool) TxsFront() *clist.CElement {
return mem.txs.Front()
}

// GetTxByKey is not supported by the v0 mempool but it is required to satisfy the mempool interface.
// GetTxByKey retrieves a transaction from the mempool using its key.
func (mem *CListMempool) GetTxByKey(key types.TxKey) (types.Tx, bool) {
return nil, false
e, ok := mem.txsMap.Load(key)
if !ok {
return nil, false
}
memTx, ok := e.(*clist.CElement).Value.(*mempoolTx)
return memTx.tx, ok
}

// IsTxEvicted is not supported by the v0 mempool but it is required to satisfy the mempool interface.
func (mem *CListMempool) IsTxEvicted(key types.TxKey) bool {
// WasRecentlyEvicted returns false consistently as this implementation does not support transaction eviction.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question] why does this implementation not support transaction eviction?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

evicted txs are valid transactions that were evicted because of size/ttl reasons for example when mempool is full. afaik Clist mempool on the other hand directly rejects transactions if the cache is full rather than evicting them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also no TTL on the v0 mempool

func (mem *CListMempool) WasRecentlyEvicted(key types.TxKey) bool {
return false
}

Expand Down
26 changes: 26 additions & 0 deletions mempool/v0/clist_mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,32 @@ func TestMempool_CheckTxChecksTxSize(t *testing.T) {
}
}

func TestGetTxByKey(t *testing.T) {
app := kvstore.NewApplication()
cc := proxy.NewLocalClientCreator(app)

mp, cleanup := newMempoolWithApp(cc)
defer cleanup()

// Create a tx
tx := types.Tx([]byte{0x01})
// Add it to the mempool
err := mp.CheckTx(tx, nil, mempool.TxInfo{})
require.NoError(t, err)

// Query the tx from the mempool
got, ok := mp.GetTxByKey(tx.Key())
require.True(t, ok)
// Ensure the returned tx is the same as the one we added
require.Equal(t, tx, got)

// Query a random tx from the mempool
randomTx, ok := mp.GetTxByKey(types.Tx([]byte{0x02}).Key())
// Ensure the returned tx is nil
require.False(t, ok)
require.Nil(t, randomTx)
}

func TestMempoolTxsBytes(t *testing.T) {
app := kvstore.NewApplication()
cc := proxy.NewLocalClientCreator(app)
Expand Down
8 changes: 4 additions & 4 deletions mempool/v1/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func NewTxMempool(
}
if cfg.CacheSize > 0 {
txmp.cache = mempool.NewLRUTxCache(cfg.CacheSize)
txmp.evictedTxs = mempool.NewLRUTxCache(cfg.CacheSize)
txmp.evictedTxs = mempool.NewLRUTxCache(cfg.CacheSize / 5)
}

for _, opt := range options {
Expand Down Expand Up @@ -273,9 +273,9 @@ func (txmp *TxMempool) GetTxByKey(txKey types.TxKey) (types.Tx, bool) {
return nil, false
}

// IsTxEvicted returns a bool indicating whether the transaction with
// the specified key was recently evicted and is currently within the cache.
func (txmp *TxMempool) IsTxEvicted(txKey types.TxKey) bool {
// WasRecentlyEvicted returns a bool indicating whether the transaction with
// the specified key was recently evicted and is currently within the evicted cache.
func (txmp *TxMempool) WasRecentlyEvicted(txKey types.TxKey) bool {
return txmp.evictedTxs.HasKey(txKey)
}

Expand Down
22 changes: 11 additions & 11 deletions mempool/v1/mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func TestTxMempool_Eviction(t *testing.T) {
require.False(t, txExists(bigTx))
bigTxKey := types.Tx((bigTx)).Key()
require.False(t, txmp.cache.HasKey(bigTxKey))
require.True(t, txmp.IsTxEvicted(bigTxKey)) // bigTx evicted
require.True(t, txmp.WasRecentlyEvicted(bigTxKey)) // bigTx evicted
require.Equal(t, int64(len("key1=0000=25")), txmp.SizeBytes())

// Now fill up the rest of the slots with other transactions.
Expand All @@ -255,15 +255,15 @@ func TestTxMempool_Eviction(t *testing.T) {
// A new transaction with low priority should be discarded.
mustCheckTx(t, txmp, "key6=0005=1")
require.False(t, txExists("key6=0005=1"))
require.True(t, txmp.IsTxEvicted(types.Tx(("key6=0005=1")).Key())) // key6 evicted
require.True(t, txmp.WasRecentlyEvicted(types.Tx(("key6=0005=1")).Key())) // key6 evicted

// A new transaction with higher priority should evict key5, which is the
// newest of the two transactions with lowest priority.
mustCheckTx(t, txmp, "key7=0006=7")
require.True(t, txExists("key7=0006=7")) // new transaction added
require.False(t, txExists("key5=0004=3")) // newest low-priority tx evicted
require.True(t, txmp.IsTxEvicted(types.Tx(("key5=0004=3")).Key())) // key5 evicted
require.True(t, txExists("key4=0003=3")) // older low-priority tx retained
require.True(t, txExists("key7=0006=7")) // new transaction added
require.False(t, txExists("key5=0004=3")) // newest low-priority tx evicted
require.True(t, txmp.WasRecentlyEvicted(types.Tx(("key5=0004=3")).Key())) // key5 evicted
require.True(t, txExists("key4=0003=3")) // older low-priority tx retained

// Another new transaction evicts the other low-priority element.
mustCheckTx(t, txmp, "key8=0007=20")
Expand All @@ -274,7 +274,7 @@ func TestTxMempool_Eviction(t *testing.T) {
mustCheckTx(t, txmp, "key9=0008=9")
require.True(t, txExists("key9=0008=9"))
require.False(t, txExists("key2=0001=5"))
require.True(t, txmp.IsTxEvicted(types.Tx(("key2=0001=5")).Key())) // key2 evicted
require.True(t, txmp.WasRecentlyEvicted(types.Tx(("key2=0001=5")).Key())) // key2 evicted

// Add a transaction that requires eviction of multiple lower-priority
// entries, in order to fit the size of the element.
Expand All @@ -283,11 +283,11 @@ func TestTxMempool_Eviction(t *testing.T) {
require.True(t, txExists("key8=0007=20"))
require.True(t, txExists("key10=0123456789abcdef=11"))
require.False(t, txExists("key3=0002=10"))
require.True(t, txmp.IsTxEvicted(types.Tx(("key3=0002=10")).Key())) // key3 evicted
require.True(t, txmp.WasRecentlyEvicted(types.Tx(("key3=0002=10")).Key())) // key3 evicted
require.False(t, txExists("key9=0008=9"))
require.True(t, txmp.IsTxEvicted(types.Tx(("key9=0008=9")).Key())) // key9 evicted
require.True(t, txmp.WasRecentlyEvicted(types.Tx(("key9=0008=9")).Key())) // key9 evicted
require.False(t, txExists("key7=0006=7"))
require.True(t, txmp.IsTxEvicted(types.Tx(("key7=0006=7")).Key())) // key7 evicted
require.True(t, txmp.WasRecentlyEvicted(types.Tx(("key7=0006=7")).Key())) // key7 evicted
}

func TestTxMempool_Flush(t *testing.T) {
Expand Down Expand Up @@ -591,7 +591,7 @@ func TestTxMempool_ExpiredTxs_Timestamp(t *testing.T) {
// All the transactions in the original set should have been purged.
for _, tx := range added1 {
// Check that they were added to the evicted cache.
evicted := txmp.IsTxEvicted(tx.tx.Key())
evicted := txmp.WasRecentlyEvicted(tx.tx.Key())
require.True(t, evicted)

if _, ok := txmp.txByKey[tx.tx.Key()]; ok {
Expand Down
12 changes: 6 additions & 6 deletions rpc/core/mocks/mempool.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading