Skip to content

Commit c3b2058

Browse files
authored
Merge pull request #68 from blinklabs-io/fix/chainsync-bulk-mode-tx-events
fix: create TX events in bulk mode for chainsync
2 parents 7fb52ea + 6a15b9c commit c3b2058

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

input/chainsync/chainsync.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,12 @@ func (c *ChainSync) handleRollForward(blockType uint, blockData interface{}, tip
229229
}
230230

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

0 commit comments

Comments
 (0)