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:
7 files changed
+45
-142
No files matched your search
+2
-2
@@ -442,7 +442,7 @@ type ChannelRouter struct {
|
||||
// channelEdgeMtx is a mutex we use to make sure we process only one
|
||||
// ChannelEdgePolicy at a time for a given channelID, to ensure
|
||||
// consistency between the various database accesses.
|
||||
channelEdgeMtx *multimutex.Mutex
|
||||
channelEdgeMtx *multimutex.Mutex[uint64]
|
||||
|
||||
// statTicker is a resumable ticker that logs the router's progress as
|
||||
// it discovers channels or receives updates.
|
||||
@@ -480,7 +480,7 @@ func New(cfg Config) (*ChannelRouter, error) {
|
||||
networkUpdates: make(chan *routingMsg),
|
||||
topologyClients: &lnutils.SyncMap[uint64, *topologyClient]{},
|
||||
ntfnClientUpdates: make(chan *topologyClientUpdate),
|
||||
channelEdgeMtx: multimutex.NewMutex(),
|
||||
channelEdgeMtx: multimutex.NewMutex[uint64](),
|
||||
selfNode: selfNode,
|
||||
statTicker: ticker.New(defaultStatInterval),
|
||||
stats: new(routerStats),
|
||||
|
||||
Reference in new issue
Block a user