Skip to content

Commit

Permalink
Merge pull request #68 from blinklabs-io/fix/chainsync-bulk-mode-tx-e…
Browse files Browse the repository at this point in the history
…vents

fix: create TX events in bulk mode for chainsync
  • Loading branch information
agaffney authored Aug 31, 2023
2 parents 7fb52ea + 6a15b9c commit c3b2058
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions input/chainsync/chainsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,12 @@ func (c *ChainSync) handleRollForward(blockType uint, blockData interface{}, tip
}

func (c *ChainSync) handleBlockFetchBlock(block ledger.Block) error {
evt := event.New("chainsync.block", time.Now(), NewBlockEvent(block, c.includeCbor))
c.eventChan <- evt
c.updateStatus(block.SlotNumber(), block.BlockNumber(), block.Hash(), c.bulkRangeEnd.Slot, hex.EncodeToString(c.bulkRangeEnd.Hash))
blockEvt := event.New("chainsync.block", time.Now(), NewBlockEvent(block, c.includeCbor))
c.eventChan <- blockEvt
for _, transaction := range block.Transactions() {
txEvt := event.New("chainsync.transaction", time.Now(), NewTransactionEvent(block, transaction, c.includeCbor))
c.eventChan <- txEvt
}
// Start normal chain-sync if we've reached the last block of our bulk range
if block.SlotNumber() == c.bulkRangeEnd.Slot {
if err := c.oConn.ChainSync().Client.Sync(c.intersectPoints); err != nil {
Expand Down

0 comments on commit c3b2058

Please sign in to comment.