eth, graphql, internal/ethapi, les: polish and improve graphql (#19886)

This commit is contained in:
gary rong
2019-07-25 14:29:53 +08:00
committed by Péter Szilágyi
parent e4232c153b
commit 8812c4d3f9
5 changed files with 49 additions and 96 deletions

View File

@ -89,6 +89,10 @@ func (b *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumbe
return b.eth.blockchain.GetBlockByNumber(uint64(number)), nil
}
func (b *EthAPIBackend) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error) {
return b.eth.blockchain.GetBlockByHash(hash), nil
}
func (b *EthAPIBackend) StateAndHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*state.StateDB, *types.Header, error) {
// Pending state is only known by the miner
if number == rpc.PendingBlockNumber {
@ -107,14 +111,6 @@ func (b *EthAPIBackend) StateAndHeaderByNumber(ctx context.Context, number rpc.B
return stateDb, header, err
}
func (b *EthAPIBackend) GetHeader(ctx context.Context, hash common.Hash) *types.Header {
return b.eth.blockchain.GetHeaderByHash(hash)
}
func (b *EthAPIBackend) GetBlock(ctx context.Context, hash common.Hash) (*types.Block, error) {
return b.eth.blockchain.GetBlockByHash(hash), nil
}
func (b *EthAPIBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) {
return b.eth.blockchain.GetReceiptsByHash(hash), nil
}