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

Commit

Permalink
Merge pull request #1549 from NebulousLabs/old-contracts
Browse files Browse the repository at this point in the history
fake startheight for old contracts
  • Loading branch information
David Vorick committed Jan 17, 2017
2 parents 2affa98 + 0e3b4a4 commit 72de07c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions modules/renter/contractor/persist.go
Expand Up @@ -62,9 +62,6 @@ func (c *Contractor) load() error {
for _, rev := range data.CachedRevisions {
c.cachedRevisions[rev.Revision.ParentID] = rev
}
for _, contract := range data.Contracts {
c.contracts[contract.ID] = contract
}
c.currentPeriod = data.CurrentPeriod
if c.currentPeriod == 0 {
// COMPATv1.0.4-lts
Expand All @@ -78,6 +75,16 @@ func (c *Contractor) load() error {
}
c.currentPeriod = highestEnd - c.allowance.Period
}
for _, contract := range data.Contracts {
// COMPATv1.0.4-lts
// If loading old persist, start height of contract is unknown. Give
// the contract a fake startheight so that it will included with the
// other contracts in the current period.
if contract.StartHeight == 0 {
contract.StartHeight = c.currentPeriod + 1
}
c.contracts[contract.ID] = contract
}
c.lastChange = data.LastChange
for _, contract := range data.OldContracts {
c.oldContracts[contract.ID] = contract
Expand Down

0 comments on commit 72de07c

Please sign in to comment.