Skip to content

Commit acb8575

Browse files
committed
staticaddr: remove new address mutex
1 parent f75f351 commit acb8575

1 file changed

Lines changed: 1 addition & 20 deletions

File tree

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
@@ -183,25 +180,9 @@ func (m *Manager) NewAddress(ctx context.Context) (*Parameters, error) {
183180
// newAddress contains the body of the former NewAddress method and performs the
184181
// actual address creation/lookup according to the requested type.
185182
func (m *Manager) newAddress(ctx context.Context) (*Parameters, error) {
186-
// If there's already a static address in the database, we can return
187-
// it.
188-
m.Lock()
189-
addresses, err := m.cfg.Store.GetAllStaticAddresses(ctx)
190-
if err != nil {
191-
m.Unlock()
192-
193-
return nil, err
194-
}
195-
if len(addresses) > 0 {
196-
m.Unlock()
197-
198-
return addresses[0], nil
199-
}
200-
m.Unlock()
201-
202183
// We are fetching a new L402 token from the server. There is one static
203184
// address per L402 token allowed.
204-
err = m.cfg.FetchL402(ctx)
185+
err := m.cfg.FetchL402(ctx)
205186
if err != nil {
206187
return nil, err
207188
}

0 commit comments

Comments
 (0)