NebulousLabs / Sia

Blockchain-based marketplace for file storage. Project has moved to GitLab: https://gitlab.com/NebulousLabs/Sia
https://sia.tech
MIT License
2.71k stars 442 forks source link

Add `locked` field to contract utilities #3105

Closed ChrisSchinnerl closed 6 years ago

ChrisSchinnerl commented 6 years ago

ContractUtilities are potentially reset every time managedMarkContractsUtility is run. If we cancel the allowance or set a contract to !goodForUpload or !goodForRenew because it failed to renew too many times, we don't want managedMarkContractsUtility to reset those fields to true again. This PR introduces the locked field that prevents those fields from being reset to true.

Note: previously we depended on threadedContractMaintenance not being run when the allowance was canceled and the renew code to setting the fields back to false right after resetting them but those are not well-known assumptions. In fact I forgot about those myself when I locked at the code a few weeks later so I think we should make stronger guarantees for those fields not to be changed.