Closed trajan0x closed 2 weeks ago
The getBlockNumber
method in the chainListener
struct is optimized to retrieve block headers instead of full blocks. This is achieved by replacing the BlockByNumber
method with HeaderByNumber
and directly assigning the block number from the header's field. This change improves efficiency by reducing the amount of data retrieved and processed.
File | Change Summary |
---|---|
ethergo/listener/listener.go |
Updated getBlockNumber method to use HeaderByNumber instead of BlockByNumber for block retrieval. |
sequenceDiagram
participant ctx as Context
participant Listener as chainListener
participant Client as BlockchainClient
Note over Listener, Client: Old Flow
Listener ->>+ Client: BlockByNumber(ctx, blockNumber)
Client -->>- Listener: Return Full Block
Listener ->> Listener: blockNumber := block.Number()
Note over Listener, Client: New Flow
Listener ->>+ Client: HeaderByNumber(ctx, blockNumber)
Client -->>- Listener: Return Block Header
Listener ->> Listener: blockNumber := block.Number
In code we crafted with delight,
Headers gained a lighter flight,
From blocks to heads, we made the switch,
A small tweak, a perfect pitch.
Now numbers shine in swift array,
Efficiency shall lead the way! 🌟
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 25.29940%. Comparing base (
99185a5
) to head (4514e87
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Latest commit: |
4514e87
|
Status: | ✅ Deploy successful! |
Preview URL: | https://e3bd8508.sanguine-fe.pages.dev |
Branch Preview URL: | https://fix-l2-listener.sanguine-fe.pages.dev |
Description
fixes listener when tx type is unsupported
Summary by CodeRabbit