From 4cb29bde2e314fbef51773f2d39cd49dfc6c5033 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 29 Nov 2016 13:57:46 +0100 Subject: [PATCH] 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. --- ethclient/ethclient.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index 00edd90e1..8a25678d8 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -123,6 +123,9 @@ func (ec *Client) getBlock(ctx context.Context, method string, args ...interface if reqs[i].Error != nil { return nil, reqs[i].Error } + if uncles[i] == nil { + return nil, fmt.Errorf("got null header for uncle %d of block %x", i, body.Hash[:]) + } } } return types.NewBlockWithHeader(head).WithBody(body.Transactions, uncles), nil -- GitLab