Skip to content

Commit 2c84af8

Browse files
fix: fix a misplaced unlock (ethersphere#2124)
1 parent d174a00 commit 2c84af8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pkg/accounting/accounting.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,12 @@ func (a *Accounting) Reserve(ctx context.Context, peer swarm.Address, price uint
197197
accountingPeer := a.getAccountingPeer(peer)
198198

199199
accountingPeer.lock.Lock()
200+
defer accountingPeer.lock.Unlock()
200201

201202
if !accountingPeer.connected {
202203
return fmt.Errorf("connection not initialized yet")
203204
}
204205

205-
defer accountingPeer.lock.Unlock()
206-
207206
a.metrics.AccountingReserveCount.Inc()
208207
bigPrice := new(big.Int).SetUint64(price)
209208

0 commit comments

Comments
 (0)