hathor-core
hathor-core copied to clipboard
`AddressIndex.get_sorted_from_address()` has different behaviors between memory and rocksdb implementation
The method docstring does not specify what the sorting key is. The memory implementation sorts by hash, while the rocksdb implementation sorts by timestamp.
I see. Would there be any issue anywhere (maybe wallet-service or headless-wallet) if this behavior changed from a fullnode upgrade?
I see two options to make them have the same behavior:
- change the memory implementation to sort by timestamp, which would cause a change in behavior from one version to another
- change the rocksdb implementation to sort by hash, which will need a migration to be implemented to make sure that the database is not corrupted
I'm leaning towards the first option, just because sorting by timestamp makes much more sense to me.
I guess @pedroferreira1 can help us here. As far as I understood, we can safely sort by timestamp.
This method is only used in one API to get all tx ids of an address in a fixed order, so we can paginate this API using the last hash sent.
Given that, changing the sort field won't create any problem, only if a use case is using this API for another case (which I think is unlikely). I feel we can change this behavior and warn in the change log