HomePhabricator

[token-server] Add function getTxTimestamp to get best timestamp from a chronik…

Description

[token-server] Add function getTxTimestamp to get best timestamp from a chronik Tx_InNode

Summary: Add function to get best timestamp from a chronik Tx_InNode object. Use timeFirstSeen if available. If unavailable and the tx is in a block, use block timestamp. If the tx is unconfirmed and also has timeFirstSeen of 0 (unlikely edge case implying chronik just indexed and the tx is not confirmed), return -1 to denote that the timestamp is unknown.

Test Plan: npm test

Reviewers: #bitcoin_abc, emack

Reviewed By: #bitcoin_abc, emack

Differential Revision: https://reviews.bitcoinabc.org/D15647

Details

Provenance
bytesofmanAuthored on Mar 6 2024, 17:36
bytesofmanPushed on Mar 7 2024, 11:59
Reviewer
Restricted Project
Differential Revision
D15647: [token-server] Add function getTxTimestamp to get best timestamp from a chronik Tx_InNode
Parents
rABC3822e5b6fc2e: [mock-chronik-client] Move to modules
Branches
Unknown
Tags
Unknown