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

Support allowance canceling #1533

Merged
merged 3 commits into from Jan 10, 2017
Merged

Support allowance canceling #1533

merged 3 commits into from Jan 10, 2017

Conversation

lukechampine
Copy link
Member

The allowance can now be canceled via SetAllowance(Allowance{}). Doing so will cause all active contracts to be immediately archived. Archived contracts cannot be used to create Editors or Downloaders, and they are not renewed. And since the new value of allowance.Hosts is 0, the contractor will not attempt to form any new contracts.

Supporting this change in the API required relaxing the restrictions on requiredHosts and requiredRenewWindow.

An important consideration here is that SetAllowance(Allowance{}) must invalidate all active editors and downloaders before archiving contracts and returning. Otherwise, an editor could save its updated contract to c.contracts after the previous version had been archived.

The test could be more comprehensive. It might be good enough to monitor the Unspent metric.


// Create a file.
path := filepath.Join(st.dir, "test.dat")
err = createRandFile(path, 1024)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be a lot bigger if you want to check that uploads are being interrupted I think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh seems that you don't check it was interrupted

@DavidVorick DavidVorick merged commit 5cfddd0 into master Jan 10, 2017
@DavidVorick
Copy link
Member

Guess we need to try this in the UI now

@lukechampine lukechampine deleted the cancel-allowance branch January 10, 2017 23:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants