Skip to content

Commit 9dc17a3

Browse files
authored
fix(sensor): getParentBlock short circuit (#762)
1 parent 76f2b14 commit 9dc17a3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

p2p/database/json.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ func (j *JSONDatabase) WritePeers(ctx context.Context, peers []*p2p.Peer, tls ti
333333

334334
// HasBlock always returns true to avoid unnecessary parent block fetching for JSON output.
335335
func (j *JSONDatabase) HasBlock(ctx context.Context, hash common.Hash) bool {
336-
return true
336+
return false
337337
}
338338

339339
// MaxConcurrentWrites returns the max concurrency.

p2p/protocol.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ func (c *conn) getBlockData(hash common.Hash, cache BlockCache, isParent bool) e
328328
// getParentBlock will send a request to the peer if the parent of the header
329329
// does not exist in the database.
330330
func (c *conn) getParentBlock(ctx context.Context, header *types.Header) error {
331-
if !c.db.ShouldWriteBlocks() || !c.db.ShouldWriteBlockEvents() {
331+
if !c.db.ShouldWriteBlocks() {
332332
return nil
333333
}
334334

0 commit comments

Comments
 (0)