Permalink
Browse files

Merge pull request #1537 from NebulousLabs/allowance-sync

require consensusset to be synced to set allowance
  • Loading branch information...
2 parents 37dadb9 + 9a1f000 commit 0c8cf785496936a6fa21979bbe711d53349db55d @DavidVorick DavidVorick committed on GitHub Jan 11, 2017
Showing with 3 additions and 0 deletions.
  1. +3 −0 modules/renter/contractor/allowance.go
@@ -13,6 +13,7 @@ var (
errAllowanceNoHosts = errors.New("hosts must be non-zero")
errAllowanceZeroPeriod = errors.New("period must be non-zero")
errAllowanceWindowSize = errors.New("renew window must be less than period")
+ errAllowanceNotSynced = errors.New("you must be synced to set an allowance")
// ErrAllowanceZeroWindow is returned when the caller requests a
// zero-length renewal window. This will happen if the caller sets the
@@ -65,6 +66,8 @@ func (c *Contractor) SetAllowance(a modules.Allowance) error {
return ErrAllowanceZeroWindow
} else if a.RenewWindow >= a.Period {
return errAllowanceWindowSize
+ } else if !c.cs.Synced() {
+ return errAllowanceNotSynced
}
// calculate the maximum sectors this allowance can store

0 comments on commit 0c8cf78

Please sign in to comment.