You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, Sheikah sorts transactions by timestamp and timelock. Due to pagination, it only could order transactions page by page.
Sheikah needs to receive the transactions paginated sorted by timestamp and timelock in order to have a coherent UI where the first transaction unlocked is shown at the top of the first page.
The text was updated successfully, but these errors were encountered:
gabaldon
changed the title
[Wallet] Paginate transactions by timestamp, taking into account the timelock
[Wallet] Paginate transactions sorted by timestamp, taking into account the timelock
Apr 12, 2021
Currently transactions are not sorted, they are simply inserted in the database in the order they are seen. So to implement this, we would need to change the logic that inserts transactions in the database. This means that old transactions will keep the wrong order, unless we manually reorder them which I don't know if is possible.
Another option would be to read the transaction range, then also read all the transactions before and after these ones that have the same timestamp, then sort them, and then apply pagination and send the transaction range to sheikah, I guess that would be easier to implement but it's still very error prone.
I assume that the transactions are already sorted by block and the timestamp is just equal to the block number, so some pseudocode for option 2 would be:
# This is the database, 0 means transaction in block 0, 1 means transaction in block 1, etc
# I assume that the transactions are already sorted by block, but we should verify that assumption
00001111222233334444
# Ask for 5 transactions with offset 6
11222
# Read all the transactions on the left and on the right that have the same block number
# as the first and the last transaction
11112222
# Sort them by block number, then by timelock
11112222
# Return the 5 transactions that are in the desired position
11222
With that approach the database order would not change, so we would need to sort them every time. Also, that algorithm could be implemented in sheikah and that will probably be the easiest option.
Question: how to sort transactions by timelock when there is more than one output? Because each output can have a different timelock. Can we simply use the timelock of the first output? Or maybe the maximum of all the timelocks?
Currently, Sheikah sorts transactions by timestamp and timelock. Due to pagination, it only could order transactions page by page.
Sheikah needs to receive the transactions paginated sorted by timestamp and timelock in order to have a coherent UI where the first transaction unlocked is shown at the top of the first page.
The text was updated successfully, but these errors were encountered: