Skip to content

Commit e26902b

Browse files
committed
staticaddr: remove new address mutex
1 parent 968bb50 commit e26902b

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

staticaddr/address/manager.go

Lines changed: 1 addition & 20 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
@@ -178,25 +175,9 @@ func (m *Manager) NewAddress(ctx context.Context) (*Parameters, error) {
178175
// newAddress contains the body of the former NewAddress method and performs the
179176
// actual address creation/lookup according to the requested type.
180177
func (m *Manager) newAddress(ctx context.Context) (*Parameters, error) {
181-
// If there's already a static address in the database, we can return
182-
// it.
183-
m.Lock()
184-
addresses, err := m.cfg.Store.GetAllStaticAddresses(ctx)
185-
if err != nil {
186-
m.Unlock()
187-
188-
return nil, err
189-
}
190-
if len(addresses) > 0 {
191-
m.Unlock()
192-
193-
return addresses[0], nil
194-
}
195-
m.Unlock()
196-
197178
// We are fetching a new L402 token from the server. There is one static
198179
// address per L402 token allowed.
199-
err = m.cfg.FetchL402(ctx)
180+
err := m.cfg.FetchL402(ctx)
200181
if err != nil {
201182
return nil, err
202183
}

0 commit comments

Comments
 (0)