Skip to content

Commit 957c6e9

Browse files
committed
chore: linter
1 parent 7080788 commit 957c6e9

File tree

2 files changed

+1
-46
lines changed

2 files changed

+1
-46
lines changed

mempool/cat/reactor_test.go

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package cat
33
import (
44
"encoding/hex"
55
"os"
6-
"sync"
76
"testing"
87
"time"
98

@@ -29,11 +28,6 @@ import (
2928
"github.com/cometbft/cometbft/types"
3029
)
3130

32-
const (
33-
numTxs = 10
34-
timeout = 120 * time.Second // ridiculously high because CircleCI is slow
35-
)
36-
3731
type peerState struct {
3832
height int64
3933
}
@@ -373,45 +367,6 @@ func newMempoolWithAppAndConfig(cc proxy.ClientCreator, conf *cfg.Config) (*TxPo
373367
return mp, func() { os.RemoveAll(conf.RootDir) }
374368
}
375369

376-
func waitForTxsOnReactors(t *testing.T, txs types.Txs, reactors []*Reactor) {
377-
// wait for the txs in all mempools
378-
wg := new(sync.WaitGroup)
379-
for i, reactor := range reactors {
380-
wg.Add(1)
381-
go func(r *Reactor, reactorIndex int) {
382-
defer wg.Done()
383-
waitForTxsOnReactor(t, txs, r, reactorIndex)
384-
}(reactor, i)
385-
}
386-
387-
done := make(chan struct{})
388-
go func() {
389-
wg.Wait()
390-
close(done)
391-
}()
392-
393-
timer := time.After(timeout)
394-
select {
395-
case <-timer:
396-
t.Fatal("Timed out waiting for txs")
397-
case <-done:
398-
}
399-
}
400-
401-
func waitForTxsOnReactor(t *testing.T, txs types.Txs, reactor *Reactor, reactorIndex int) {
402-
mempool := reactor.mempool
403-
for mempool.Size() < len(txs) {
404-
time.Sleep(time.Millisecond * 100)
405-
}
406-
407-
reapedTxs := mempool.ReapMaxTxs(len(txs))
408-
for i, tx := range txs {
409-
require.Contains(t, types.CachedTxToSliceOfBytes(reapedTxs), tx)
410-
require.Equal(t, tx, reapedTxs[i].Tx,
411-
"txs at index %d on reactor %d don't match: %x vs %x", i, reactorIndex, tx, reapedTxs[i])
412-
}
413-
}
414-
415370
func genPeers(n int) []*mocks.Peer {
416371
peers := make([]*mocks.Peer, n)
417372
for i := 0; i < n; i++ {

types/part_set.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ func (ps *PartSet) AddPart(part *Part) (bool, error) {
507507
}
508508

509509
ps.mtx.Lock()
510-
ps.mtx.Unlock()
510+
defer ps.mtx.Unlock()
511511
// The proof should be compatible with the number of parts.
512512
if part.Proof.Total != int64(ps.total) {
513513
return false, fmt.Errorf(ErrPartSetInvalidProofTotal.Error()+":%v %v", part.Proof.Total, ps.total)

0 commit comments

Comments
 (0)