lukechampine / user

A CLI renter for Sia
MIT License
12 stars 2 forks source link

Checkup all enabled contracts #17

Open lukechampine opened 4 years ago

lukechampine commented 4 years ago

user checkup performs a "health check" on a contract or metafile by downloading a random piece of it from its hosts. As a convenience, it should be possible to run a checkup on all enabled contracts with one command. In the same vein, perhaps we could allow running a checkup on all metafiles in a folder.

Now that I think of it, checkup is really doing "double-duty:" when you run it on a contract, you're checking whether that contract is usable, but when you run it on a metafile, you're checking whether that metafile is retrievable. These are different things: the fact that a contract is usable (i.e. the renter and host agree on its current state and can revise it) does not imply that the host is actually storing all of the contract data.

For clarity, it might be best to split these into separate commands. Contract checkups should be run frequently, so that unusable contracts are detected as soon as possible and can be replaced. (Also, contract checkups should probably call the Write RPC, since that's a tougher "check" than Read.) Metafile checkups can be run less frequently, and perhaps the checkup should involve downloading a much greater percentage of the file, rather than a single sector.