Skip to content
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.

Commit

Permalink
fix spaceRemaining bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechampine committed May 26, 2015
1 parent 63dcac2 commit 5350bd8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/host/host.go
Expand Up @@ -87,14 +87,14 @@ func New(cs *consensus.State, tpool modules.TransactionPool, wallet modules.Wall
UnlockHash: coinAddr,
},

saveDir: saveDir,
spaceRemaining: 2e9,
saveDir: saveDir,

obligationsByID: make(map[types.FileContractID]contractObligation),
obligationsByHeight: make(map[types.BlockHeight][]contractObligation),

mu: sync.New(modules.SafeMutexDelay, 1),
}
h.spaceRemaining = h.TotalStorage

// Create listener and set address.
h.listener, err = net.Listen("tcp", addr)
Expand Down Expand Up @@ -123,6 +123,7 @@ func New(cs *consensus.State, tpool modules.TransactionPool, wallet modules.Wall
func (h *Host) SetSettings(settings modules.HostSettings) {
lockID := h.mu.Lock()
defer h.mu.Unlock(lockID)
h.spaceRemaining += settings.TotalStorage - h.TotalStorage
h.HostSettings = settings
h.save()
}
Expand Down

0 comments on commit 5350bd8

Please sign in to comment.