Skip to content

Bring back host and renter

Luke Champine requested to merge host into master

The host and renter (and their associated API calls) are back online. File contracts now conform to the spec outlined in #290 (closed) (I hope), so be sure to close that issue in the merge commit. Another nice thing is that Merkle roots are now calculated as the file is being transferred over the network, instead of having to process the entire file twice. Finally, I tweaked the Makefile a bit to prevent slow rebuilds. (tl;dr: back to the touch method, but a bit more sophisticated.)

As it often goes, delving into the codebase shed light on a lot of "gotchas", as well as areas for future improvement. I fixed most of the ones I came across, and tried to write the rest down.

Things that should be done soon:

  • Need to be making one file contract per window, instead of one big contract
  • Storage proof stuff is still commented out; we need a good way for the host to interact with the state
  • When checking for host announcements, call IsStandard to catch duplicate FreezeIndexs
  • Tests. Lots of tests.

Thoughts for the future:

  • Timeouts need to be more sophisticated. As it stands, when we do file transfers we just use a really, really long timeout. The network package should be in charge of monitoring connections and closing them when certain timeout conditions have been met.
  • It's probably a good idea to have a protocol package, or at least one file with all the protocol information in it -- structs, strings, errors, everything that gets sent over the wire. A good time to do this would be when we're ready to start locking down the protocol.
  • I don't like having network-level code in the host/renter modules. The specifics of who sends what, and in what order, seems like a protocol-level issue. With careful design, I think it could be moved elsewhere, perhaps to the daemon -- but I'm not yet confident that it would be worth the effort.

Also: net negative. awwwwright.

Merge request reports