From 460d1586e68716d4a3fd2f9f867679260883b2c1 Mon Sep 17 00:00:00 2001 From: Nick Johnson Date: Mon, 15 Oct 2018 14:16:36 +0100 Subject: [PATCH] Added ommerCount to Block --- ethgraphql/main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ethgraphql/main.go b/ethgraphql/main.go index 70e76ed794..b2dcdff185 100644 --- a/ethgraphql/main.go +++ b/ethgraphql/main.go @@ -608,6 +608,14 @@ func (b *Block) OmmerHash(ctx context.Context) (Bytes32, error) { return Bytes32{block.UncleHash()}, nil } +func (b *Block) OmmerCount(ctx context.Context) (int32, error) { + block, err := b.resolve(ctx) + if err != nil { + return 0, err + } + return int32(len(block.Uncles())), nil +} + func (b *Block) Ommers(ctx context.Context) ([]*Block, error) { block, err := b.resolve(ctx) if err != nil { @@ -890,6 +898,7 @@ func NewHandler(n *node.Node) (http.Handler, error) { mixHash: Bytes32! difficulty: BigNum! totalDifficulty: BigNum! + ommerCount: Int! ommers: [Block]! ommerHash: Bytes32! transactions: [Transaction!]!