Skip to content

Commit 2e2a28e

Browse files
committed
staticaddr: remove new address mutex
1 parent c3a6fae commit 2e2a28e

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
@@ -206,20 +203,15 @@ func (m *Manager) newAddress(ctx context.Context) (*btcutil.AddressTaproot,
206203

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

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

230222
return address, expiry, nil
231223
}
232-
m.Unlock()
233224

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

0 commit comments

Comments
 (0)