Skip to content

Commit 4cb29bd

Browse files
committed
ethclient: don't crash if server returns null uncle header
It should never return null for a known uncle, but even if it does we can't just crash.
1 parent 2dcf75a commit 4cb29bd

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎ethclient/ethclient.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ func (ec *Client) getBlock(ctx context.Context, method string, args ...interface
123123
if reqs[i].Error != nil {
124124
return nil, reqs[i].Error
125125
}
126+
if uncles[i] == nil {
127+
return nil, fmt.Errorf("got null header for uncle %d of block %x", i, body.Hash[:])
128+
}
126129
}
127130
}
128131
return types.NewBlockWithHeader(head).WithBody(body.Transactions, uncles), nil

0 commit comments

Comments
 (0)