From 5e60f7758b1abbbeb34fabe445ea414252d08ded Mon Sep 17 00:00:00 2001 From: sideninja <75445744+sideninja@users.noreply.github.com> Date: Tue, 14 May 2024 19:19:27 +0200 Subject: [PATCH] add timestamp mock --- api/api.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/api/api.go b/api/api.go index 9608a2141..d7085ab6a 100644 --- a/api/api.go +++ b/api/api.go @@ -613,6 +613,18 @@ func (b *BlockChainAPI) prepareBlockResponse( Timestamp: hexutil.Uint64(block.Timestamp), } + // todo remove after previewnet, temp fix to mock some of the timestamps + if block.Timestamp == 0 { + first := uint64(1715189257) + blockTime := uint64(200) + firstRecordedTimestampBlock := uint64(5493) + + diff := firstRecordedTimestampBlock - block.Height + timestamp := first - blockTime*diff + + blockResponse.Timestamp = hexutil.Uint64(timestamp) + } + transactions, err := b.fetchBlockTransactions(ctx, block) if err != nil { return nil, err