Commit 2c84af85 authored by Ralph Pichler's avatar Ralph Pichler Committed by GitHub

fix: fix a misplaced unlock (#2124)

parent d174a004
...@@ -197,13 +197,12 @@ func (a *Accounting) Reserve(ctx context.Context, peer swarm.Address, price uint ...@@ -197,13 +197,12 @@ func (a *Accounting) Reserve(ctx context.Context, peer swarm.Address, price uint
accountingPeer := a.getAccountingPeer(peer) accountingPeer := a.getAccountingPeer(peer)
accountingPeer.lock.Lock() accountingPeer.lock.Lock()
defer accountingPeer.lock.Unlock()
if !accountingPeer.connected { if !accountingPeer.connected {
return fmt.Errorf("connection not initialized yet") return fmt.Errorf("connection not initialized yet")
} }
defer accountingPeer.lock.Unlock()
a.metrics.AccountingReserveCount.Inc() a.metrics.AccountingReserveCount.Inc()
bigPrice := new(big.Int).SetUint64(price) bigPrice := new(big.Int).SetUint64(price)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment