Skip to content

Support allowance canceling

Luke Champine requested to merge cancel-allowance into master

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.

Merge request reports