mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-10 06:07:16 +01:00
multimutex: remove HashMutex, make Mutex type a type param
In this commit, we eliminate some code duplication by removing the old `HashMutex` struct as it just duplicates all the code with a different type (uint64 and hash). We then make the main Mutex struct take a type param, so the key can be parametrized when the struct is instantiated.
This commit is contained in:
@@ -450,7 +450,7 @@ type AuthenticatedGossiper struct {
|
||||
// goroutine per channel ID. This is done to ensure that when
|
||||
// the gossiper is handling an announcement, the db state stays
|
||||
// consistent between when the DB is first read until it's written.
|
||||
channelMtx *multimutex.Mutex
|
||||
channelMtx *multimutex.Mutex[uint64]
|
||||
|
||||
recentRejects *lru.Cache[rejectCacheKey, *cachedReject]
|
||||
|
||||
@@ -496,7 +496,7 @@ func New(cfg Config, selfKeyDesc *keychain.KeyDescriptor) *AuthenticatedGossiper
|
||||
prematureChannelUpdates: lru.NewCache[uint64, *cachedNetworkMsg]( //nolint: lll
|
||||
maxPrematureUpdates,
|
||||
),
|
||||
channelMtx: multimutex.NewMutex(),
|
||||
channelMtx: multimutex.NewMutex[uint64](),
|
||||
recentRejects: lru.NewCache[rejectCacheKey, *cachedReject](
|
||||
maxRejectedUpdates,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user