mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-26 13:42:49 +02: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:
@@ -93,14 +93,14 @@ type networkResultStore struct {
|
||||
// paymentIDMtx is a multimutex used to make sure the database and
|
||||
// result subscribers map is consistent for each payment ID in case of
|
||||
// concurrent callers.
|
||||
paymentIDMtx *multimutex.Mutex
|
||||
paymentIDMtx *multimutex.Mutex[uint64]
|
||||
}
|
||||
|
||||
func newNetworkResultStore(db kvdb.Backend) *networkResultStore {
|
||||
return &networkResultStore{
|
||||
backend: db,
|
||||
results: make(map[uint64][]chan *networkResult),
|
||||
paymentIDMtx: multimutex.NewMutex(),
|
||||
paymentIDMtx: multimutex.NewMutex[uint64](),
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user