Open
Description
The chain_txns
table currently stores block_hash
and block_height
, but not timestamp
, which the TW team needs to improve UI/UX. They're currently doing an external lookup to get it. tapd
should retain this information instead of discarding it, as it currently does.
Proposed Changes
- Create a new
block_header
table (integer primary key for re-org simplicity):CREATE TABLE block_header ( id INTEGER PRIMARY KEY, hash BLOB UNIQUE NOT NULL, height INTEGER NOT NULL, timestamp TIMESTAMP NOT NULL );
- Update
chain_txns
to referenceblock_header(id)
.
Notes
- Using
id
as the primary key allows multiple blocks with the same height (re-orgs). timestamp
can beNULL
by default;tapd
will populate for new entries, simplifies migration and is fine for out use-case.
Follow-Up Work
- Add and populate the block header timestamp field in
asset.ChainAsset
. - Ensure the new
asset.ChainAsset
field is included in the relevant RPC response messages.