Skip to content

Commit c37e68e

Browse files
authored
all: replace RWMutex with Mutex in places where RLock is not used (#21622)
1 parent 32341f8 commit c37e68e

6 files changed

Lines changed: 6 additions & 7 deletions

File tree

‎accounts/keystore/file_cache.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
type fileCache struct {
3333
all mapset.Set // Set of all files from the keystore folder
3434
lastMod time.Time // Last time instance when a file was modified
35-
mu sync.RWMutex
35+
mu sync.Mutex
3636
}
3737

3838
// scan performs a new scan on the given directory, compares against the already

‎core/chain_indexer.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ type ChainIndexer struct {
9494
throttling time.Duration // Disk throttling to prevent a heavy upgrade from hogging resources
9595

9696
log log.Logger
97-
lock sync.RWMutex
97+
lock sync.Mutex
9898
}
9999

100100
// NewChainIndexer creates a new chain indexer to do background processing on

‎eth/downloader/downloader.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ type Downloader struct {
153153
cancelWg sync.WaitGroup // Make sure all fetcher goroutines have exited.
154154

155155
quitCh chan struct{} // Quit channel to signal termination
156-
quitLock sync.RWMutex // Lock to prevent double closes
156+
quitLock sync.Mutex // Lock to prevent double closes
157157

158158
// Testing hooks
159159
syncInitHook func(uint64, uint64) // Method to call upon initiating a new sync run

‎eth/downloader/downloader_test.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,6 @@ func (dl *downloadTester) dropPeer(id string) {
411411
type downloadTesterPeer struct {
412412
dl *downloadTester
413413
id string
414-
lock sync.RWMutex
415414
chain *testChain
416415
missingStates map[common.Hash]bool // State entries that fast sync should not return
417416
}
@@ -1601,7 +1600,7 @@ func TestRemoteHeaderRequestSpan(t *testing.T) {
16011600
{15000, 13006,
16021601
[]int{14823, 14839, 14855, 14871, 14887, 14903, 14919, 14935, 14951, 14967, 14983, 14999},
16031602
},
1604-
//Remote is pretty close to us. We don't have to fetch as many
1603+
// Remote is pretty close to us. We don't have to fetch as many
16051604
{1200, 1150,
16061605
[]int{1149, 1154, 1159, 1164, 1169, 1174, 1179, 1184, 1189, 1194, 1199},
16071606
},

‎les/txrelay.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type lesTxRelay struct {
3535
txPending map[common.Hash]struct{}
3636
peerList []*serverPeer
3737
peerStartPos int
38-
lock sync.RWMutex
38+
lock sync.Mutex
3939
stop chan struct{}
4040

4141
retriever *retrieveManager

‎miner/unconfirmed.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type unconfirmedBlocks struct {
5050
chain chainRetriever // Blockchain to verify canonical status through
5151
depth uint // Depth after which to discard previous blocks
5252
blocks *ring.Ring // Block infos to allow canonical chain cross checks
53-
lock sync.RWMutex // Protects the fields from concurrent access
53+
lock sync.Mutex // Protects the fields from concurrent access
5454
}
5555

5656
// newUnconfirmedBlocks returns new data structure to track currently unconfirmed blocks.

0 commit comments

Comments
 (0)