Skip to content

Commit d970363

Browse files
committed
staticaddr: remove new address mutex
1 parent a14756d commit d970363

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

staticaddr/address/manager.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"context"
66
"fmt"
7-
"sync"
87
"sync/atomic"
98

109
"github.com/btcsuite/btcd/btcec/v2"
@@ -49,8 +48,6 @@ type ManagerConfig struct {
4948

5049
// Manager manages the address state machines.
5150
type Manager struct {
52-
sync.Mutex
53-
5451
cfg *ManagerConfig
5552

5653
currentHeight atomic.Int32
@@ -207,20 +204,15 @@ func (m *Manager) newAddress(ctx context.Context) (*btcutil.AddressTaproot,
207204

208205
// If there's already a static address in the database, we can return
209206
// it.
210-
m.Lock()
211207
addresses, err := m.cfg.Store.GetAllStaticAddresses(ctx)
212208
if err != nil {
213-
m.Unlock()
214-
215209
return nil, 0, err
216210
}
217211
if len(addresses) > 0 {
218212
clientPubKey := addresses[0].ClientPubkey
219213
serverPubKey := addresses[0].ServerPubkey
220214
expiry := int64(addresses[0].Expiry)
221215

222-
defer m.Unlock()
223-
224216
address, err := m.GetTaprootAddress(
225217
clientPubKey, serverPubKey, expiry,
226218
)
@@ -230,7 +222,6 @@ func (m *Manager) newAddress(ctx context.Context) (*btcutil.AddressTaproot,
230222

231223
return address, expiry, nil
232224
}
233-
m.Unlock()
234225

235226
// We are fetching a new L402 token from the server. There is one static
236227
// address per L402 token allowed.

0 commit comments

Comments
 (0)