aboutsummaryrefslogtreecommitdiffstats
path: root/ethclient
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-11-29 20:57:46 +0800
committerFelix Lange <fjl@twurst.com>2016-12-05 02:45:55 +0800
commit4cb29bde2e314fbef51773f2d39cd49dfc6c5033 (patch)
tree2175e7cbed6dbb8e13bf282c072b7421f9bdada8 /ethclient
parent2dcf75a722f193ef5528f5af8fb4fd7c5824fded (diff)
downloadgo-tangerine-4cb29bde2e314fbef51773f2d39cd49dfc6c5033.tar.gz
go-tangerine-4cb29bde2e314fbef51773f2d39cd49dfc6c5033.tar.zst
go-tangerine-4cb29bde2e314fbef51773f2d39cd49dfc6c5033.zip
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.
Diffstat (limited to 'ethclient')
-rw-r--r--ethclient/ethclient.go3
1 files changed, 3 insertions, 0 deletions
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