Encoding and CatchUp
4-byte unsigned length prefixes are now used for both network messages and encoded objects. I think it's safe to assume that we aren't going to be sending or marshalling objects larger than 4GB. The networking code already rejects messages longer than 1 << 24.
CatchUp
and SendBlocks
have also been moved to siad, which was trickier than anticipated because they were accessing private State fields. These have been rewritten to use getters. (I didn't bother writing a BlockID getter; instead I get blocks via BlockAtHeight()
and then call ID()
on them. A BlockID getter would be saner and more efficient, but I've left it unimplemented for now.)
I may have fixed a bug or two while rewriting these, but it's hard to say without testing.
Other notes: encoding.go has been split into three files. CreateGenesisState()
has been moved to state.go. MaxCatchUpBlocks
has been moved to synchronize.go.