Added ommerCount to Block

This commit is contained in:
Nick Johnson 2018-10-15 14:16:36 +01:00
parent 76e45cf2c1
commit 460d1586e6

View file

@ -608,6 +608,14 @@ func (b *Block) OmmerHash(ctx context.Context) (Bytes32, error) {
return Bytes32{block.UncleHash()}, nil 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) { func (b *Block) Ommers(ctx context.Context) ([]*Block, error) {
block, err := b.resolve(ctx) block, err := b.resolve(ctx)
if err != nil { if err != nil {
@ -890,6 +898,7 @@ func NewHandler(n *node.Node) (http.Handler, error) {
mixHash: Bytes32! mixHash: Bytes32!
difficulty: BigNum! difficulty: BigNum!
totalDifficulty: BigNum! totalDifficulty: BigNum!
ommerCount: Int!
ommers: [Block]! ommers: [Block]!
ommerHash: Bytes32! ommerHash: Bytes32!
transactions: [Transaction!]! transactions: [Transaction!]!