Skip to content

fix: Return non-zero value for burn_block_time in v1 API#243

Merged
jbencin merged 1 commit intohirosystems:masterfrom
jbencin:fix/add-valid-timestamps
Mar 23, 2023
Merged

fix: Return non-zero value for burn_block_time in v1 API#243
jbencin merged 1 commit intohirosystems:masterfrom
jbencin:fix/add-valid-timestamps

Conversation

@jbencin
Copy link
Copy Markdown
Contributor

@jbencin jbencin commented Mar 22, 2023

Description

API endpoints extended/v1/block and extended/v1/block were empty/zero values for the following variables:

{
      "burn_block_time": 0,
      "burn_block_time_iso": "",
      "parent_burn_block_time": 0,
      "parent_burn_block_time_iso": ""
}

This was due to failing to parse and store the timestamp from the burnchain block in StacksSubnetBlock::from_new_block_event(). This PR fixes this issue so that these variables are now proper Unix and ISO-8601 timestamps:

{
      "burn_block_time": 1679512099,
      "burn_block_time_iso": "2023-03-22T19:08:19.000Z",
      "parent_burn_block_time": 1679512039,
      "parent_burn_block_time_iso": "2023-03-22T19:07:19.000Z",
}

Applicable issues

Additional info (benefits, drawbacks, caveats)

We still report 0 for genesis block. Not sure if that's a problem

Checklist

  • Test coverage for new or modified code paths
  • Changelog is updated
  • Required documentation changes (e.g., docs/rpc/openapi.yaml and rpc-endpoints.md for v2 endpoints, event-dispatcher.md for new events)
  • New clarity functions have corresponding PR in clarity-benchmarking repo
  • New integration test(s) added to bitcoin-tests.yml

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 22, 2023

Codecov Report

Merging #243 (61276de) into master (542dc5e) will increase coverage by 93.47%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           master     #243       +/-   ##
===========================================
+ Coverage        0   93.47%   +93.47%     
===========================================
  Files           0        6        +6     
  Lines           0      337      +337     
===========================================
+ Hits            0      315      +315     
- Misses          0       22       +22     

see 6 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@jbencin jbencin force-pushed the fix/add-valid-timestamps branch from 2264b75 to 3a5eb33 Compare March 22, 2023 19:49
@jbencin jbencin force-pushed the fix/add-valid-timestamps branch from 3a5eb33 to 61276de Compare March 22, 2023 21:37
Copy link
Copy Markdown
Contributor

@obycode obycode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @jbencin!

@jbencin jbencin merged commit 072cb10 into hirosystems:master Mar 23, 2023
@jbencin jbencin deleted the fix/add-valid-timestamps branch April 18, 2023 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix timestamps

2 participants