Skip to content

Commit c84589e

Browse files
committed
staticaddr: remove new address mutex
1 parent 01b3143 commit c84589e

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

173170
// If there's already a static address in the database, we can return
174171
// it.
175-
m.Lock()
176172
addresses, err := m.cfg.Store.GetAllStaticAddresses(ctx)
177173
if err != nil {
178-
m.Unlock()
179-
180174
return nil, 0, err
181175
}
182176
if len(addresses) > 0 {
183177
clientPubKey := addresses[0].ClientPubkey
184178
serverPubKey := addresses[0].ServerPubkey
185179
expiry := int64(addresses[0].Expiry)
186180

187-
defer m.Unlock()
188-
189181
address, err := m.GetTaprootAddress(
190182
clientPubKey, serverPubKey, expiry,
191183
)
@@ -195,7 +187,6 @@ func (m *Manager) newAddress(ctx context.Context) (*btcutil.AddressTaproot,
195187

196188
return address, expiry, nil
197189
}
198-
m.Unlock()
199190

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

0 commit comments

Comments
 (0)