Page MenuHomePhabricator

[Cashtab] [chronik tx history p3] Add a function to sort chronik tx history of all addresses by blockheight and timeFirstSeen
ClosedPublic

Authored by bytesofman on Sep 23 2022, 18:35.

Details

Summary

T2447

Depends on D12051

Sort tx history by blockheightand timeFirstSeen. For unconfirmed txs, sort by timeFirstSeen. Most recent transactions appear earliest in the tx history array.

Test Plan

Review unit tests and mocks to confirm desired tx order.
npm test

npm start
Send yourself some txs. In dev console, confirm that unconfirmed txs and confirmed txs are being properly sequestered. Confirm desired order in chronikTxHistory as flattened array, sorted by blockheight and time first seen.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Adding trim here, the right place

emack requested changes to this revision.EditedSep 24 2022, 15:44
emack added a subscriber: emack.

The post-confirmation sorting needs a bit more precision.
i.e.
This is the 3 txs in unconfirmed mode right after being sent in succession, which is expected

image.png (580×513 px, 57 KB)

This is after the 3 txs have each received 3 confirmations, where the 2nd tx is showing as the most recent
All three were confirmed in block 758712 with the exact same timestamp of 09/25/2022 1:26:27 AM (UTC +10:00), and exact unit timestamp 1664033187.

image.png (530×526 px, 55 KB)

For reference, the timeFIrstSeen via console log seems to show the following:
second tx: 1664033071
first tx: 1664033057
third tx: 1664033032

This revision now requires changes to proceed.Sep 24 2022, 15:44

The post-confirmation sorting needs a bit more precision.
i.e.
This is the 3 txs in unconfirmed mode right after being sent in succession, which is expected

image.png (580×513 px, 57 KB)

This is after the 3 txs have each received 3 confirmations, where the 2nd tx is showing as the most recent
All three were confirmed in block 758712 with the exact same timestamp of 09/25/2022 1:26:27 AM (UTC +10:00), and exact unit timestamp 1664033187.

image.png (530×526 px, 55 KB)

For reference, the timeFIrstSeen via console log seems to show the following:
second tx: 1664033071
first tx: 1664033057
third tx: 1664033032

Can I get these txids?

bytesofman requested review of this revision.EditedSep 25 2022, 03:51

Oh -- never mind about the txids

Note: the tx history being rendered in the app is still being done with bch-api here. So, the rendered history is still expected to be kind of random.

What matters is chronikTxHistory as flattened array, sorted by blockheight and time first seen as seen in the dev log on npm start. Later in this stack, once that has enough info, I will get the tx history to render from this chronik info.

So far, we're just getting the functions and unit tests in.

This revision is now accepted and ready to land.Sep 25 2022, 04:54