Skip to content

Conversation

@jwiegley
Copy link
Collaborator

Summary

  • Fixed inconsistent SSE event naming where block update stream was sending events named "BlockHeader" instead of "Block"
  • Header update stream correctly continues to send "BlockHeader" events
  • Aligns implementation with OpenAPI documentation

Problem

The SSE (Server-Sent Events) implementation had an inconsistency:

  • Header update stream (/header/updates): Correctly sent events named "BlockHeader"
  • Block update stream (/block/updates): Incorrectly sent events also named "BlockHeader"
  • OpenAPI documentation specified block stream events should be named "Block"

Solution

Modified blockStreamHandler in src/Chainweb/BlockHeaderDB/RestAPI/Server.hs to dynamically set event names based on the withPayloads parameter:

  • When withPayloads is true (block stream): events are named "Block"
  • When withPayloads is false (header stream): events are named "BlockHeader"

Testing

  • Build successful: cabal build chainweb
  • BlockHeaderDB tests pass
  • RestAPI tests pass
  • No breaking changes introduced

Changes

  • Modified event name generation in blockStreamHandler function
  • Single file changed: src/Chainweb/BlockHeaderDB/RestAPI/Server.hs

🤖 Generated with Claude Code

jwiegley and others added 2 commits August 22, 2025 13:09
The block update stream API was incorrectly sending events named "BlockHeader"
instead of "Block", while the header update stream correctly uses "BlockHeader".
This caused inconsistency with the OpenAPI documentation which specifies that
block stream events should be named "Block".

Changed the blockStreamHandler to dynamically set event names based on the
withPayloads parameter:
- Block update stream (/block/updates): events named "Block"
- Header update stream (/header/updates): events named "BlockHeader"

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
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.

1 participant