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 !

1 - Is there any way to store links without sorting ?
I try to store links in reverse order and I’m facing this behaviour.
2 - What are the motivations to sort the links at the server level ?