mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 19:42:23 +00:00
mempool: simpilfy boolean comparisons in test code
gosimple: S1008: should use 'return t == tx2' instead of 'if t == tx2 { return true }; return false'
This commit is contained in:
parent
cf59bd878d
commit
bd48454c72
2 changed files with 3 additions and 12 deletions
|
@ -298,10 +298,7 @@ func TestMemPoolFees(t *testing.T) {
|
|||
|
||||
// check whether sender's fee updates correctly
|
||||
mp.RemoveStale(func(t *transaction.Transaction) bool {
|
||||
if t == tx2 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return t == tx2
|
||||
}, fs)
|
||||
require.Equal(t, 1, len(mp.fees))
|
||||
require.Equal(t, utilityBalanceAndFees{
|
||||
|
@ -311,10 +308,7 @@ func TestMemPoolFees(t *testing.T) {
|
|||
|
||||
// there should be nothing left
|
||||
mp.RemoveStale(func(t *transaction.Transaction) bool {
|
||||
if t == tx3 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return t == tx3
|
||||
}, fs)
|
||||
require.Equal(t, 0, len(mp.fees))
|
||||
}
|
||||
|
|
|
@ -75,10 +75,7 @@ func TestSubscriptions(t *testing.T) {
|
|||
|
||||
// remove stale
|
||||
mp.RemoveStale(func(tx *transaction.Transaction) bool {
|
||||
if tx.Hash().Equals(txs[2].Hash()) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
return !tx.Hash().Equals(txs[2].Hash())
|
||||
}, fs)
|
||||
require.Eventually(t, func() bool { return len(subChan1) == 1 && len(subChan2) == 1 }, time.Second, time.Millisecond*100)
|
||||
event1 = <-subChan1
|
||||
|
|
Loading…
Reference in a new issue