Skip to content

Commit

Permalink
Re-add missing FIRE BLOCK output
Browse files Browse the repository at this point in the history
  • Loading branch information
maoueh committed May 8, 2024
1 parent cc82e68 commit ced11dc
Showing 1 changed file with 26 additions and 28 deletions.
54 changes: 26 additions & 28 deletions tracer/firehose_tracer.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package tracer

import (
"encoding/base64"
"fmt"
"time"

pbacme "github.com/streamingfast/dummy-blockchain/pb/sf/acme/type/v1"
"github.com/streamingfast/dummy-blockchain/types"
"google.golang.org/protobuf/proto"
)

var _ Tracer = &FirehoseTracer{}
Expand All @@ -29,33 +30,30 @@ func (t *FirehoseTracer) OnBlockEnd(blk *types.Block, finalBlockHeader *types.Bl

header := t.activeBlock.Header

// previousNum := uint64(0)
// if header.PreviousNum != nil {
// previousNum = *header.PreviousNum
// }

// previousHash := ""
// if header.PreviousHash != nil {
// previousHash = *header.PreviousHash
// }

// blockPayload, err := proto.Marshal(t.activeBlock)
// if err != nil {
// panic(fmt.Errorf("unable to marshal block: %w", err))
// }

blockTime := time.Unix(0, int64(header.Timestamp))
fmt.Println(blockTime)

// fmt.Printf("FIRE BLOCK %d %s %d %s %d %d %s\n",
// header.Height,
// header.Hash,
// previousNum,
// previousHash,
// header.FinalNum,
// header.Timestamp,
// base64.StdEncoding.EncodeToString(blockPayload),
// )
previousNum := uint64(0)
if header.PreviousNum != nil {
previousNum = *header.PreviousNum
}

previousHash := ""
if header.PreviousHash != nil {
previousHash = *header.PreviousHash
}

blockPayload, err := proto.Marshal(t.activeBlock)
if err != nil {
panic(fmt.Errorf("unable to marshal block: %w", err))
}

fmt.Printf("FIRE BLOCK %d %s %d %s %d %d %s\n",
header.Height,
header.Hash,
previousNum,
previousHash,
header.FinalNum,
header.Timestamp,
base64.StdEncoding.EncodeToString(blockPayload),
)

t.activeBlock = nil
t.activeTrx = nil
Expand Down

0 comments on commit ced11dc

Please sign in to comment.