Why sort links in pbnode

In the implementation of merkledag, the dag node will be serialized as protobuf node(PBNode). I saw in the code, the links are sorted:


But the question is when we add a big file, the file will be split into multiple nodes that linked together. If the order of the links are changed by sorting, how can we make sure get the correct order of file pieces?


We sort by names and chunk nodes aren’t named (so the stable sort doesn’t move anything).

I got it! Thanks a lot !