Instead of using a different field for each collection, this should just be sorted by "_id" field for all collections. This is due to that each ID is guaranteed to be unique since were using a custom ID for each collection.
The current way for example has total vote count a sort for delegates. If two delegates have the same total vote count, a tie will happen and their is no way to figure out what mongo will choose.
The whole point of this line is for the db to sort to some order, so when were checking DB hashes and passing data they are in the same order.
We need to test this on the testnet if ID works as if it does it will be better, the current one works but their could be edge cases of people being off syncing due to this.
🐛 BUG REPORT
Their is a possible sort order bug with the current mainnet code at https://github.com/X-CASH-official/xcash-dpops/blob/master/src/functions/database_functions/database_functions.c#L130
Instead of using a different field for each collection, this should just be sorted by "_id" field for all collections. This is due to that each ID is guaranteed to be unique since were using a custom ID for each collection.
The current way for example has total vote count a sort for delegates. If two delegates have the same total vote count, a tie will happen and their is no way to figure out what mongo will choose.
The whole point of this line is for the db to sort to some order, so when were checking DB hashes and passing data they are in the same order.
We need to test this on the testnet if ID works as if it does it will be better, the current one works but their could be edge cases of people being off syncing due to this.