Skip to content

Commit

Permalink
fix: Compute timestamp in Byron mappings (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega authored Feb 19, 2022
1 parent 1b8ab2d commit ab6a413
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mapper/byron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,13 @@ impl EventWriter {
pub fn crawl_byron_with_cbor(&self, block: &byron::Block, cbor: &[u8]) -> Result<(), Error> {
if let byron::Block::MainBlock(block) = block {
let hash = block.header.to_hash();
let abs_slot = block.header.consensus_data.0.to_abs_slot();

let child = self.child_writer(EventContext {
block_hash: Some(hex::encode(&hash)),
block_number: Some(block.header.consensus_data.2[0]),
slot: Some(block.header.consensus_data.0.to_abs_slot()),
//timestamp: self.compute_timestamp(block.header.header_body.slot),
slot: Some(abs_slot),
timestamp: self.compute_timestamp(abs_slot),
..EventContext::default()
});

Expand Down

0 comments on commit ab6a413

Please sign in to comment.