mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
add_get_block_by_tag_function
This commit is contained in:
parent
a9ab53d751
commit
ace888b9cf
1 changed files with 7 additions and 0 deletions
|
|
@ -94,6 +94,13 @@ func (ec *Client) BlockByNumber(ctx context.Context, number *big.Int) (*types.Bl
|
||||||
return ec.getBlock(ctx, "eth_getBlockByNumber", toBlockNumArg(number), true)
|
return ec.getBlock(ctx, "eth_getBlockByNumber", toBlockNumArg(number), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BlockByNumber returns a block from the current canonical chain. If tag is nil, the
|
||||||
|
// latest known block is returned.
|
||||||
|
// you can use the special tag earliest, latest, finalized, safe, or finalized.
|
||||||
|
func (ec *Client) BlockBySpecialTag(ctx context.Context, tag string) (*types.Block, error) {
|
||||||
|
return ec.getBlock(ctx, "eth_getBlockByNumber", tag, true)
|
||||||
|
}
|
||||||
|
|
||||||
// BlockNumber returns the most recent block number
|
// BlockNumber returns the most recent block number
|
||||||
func (ec *Client) BlockNumber(ctx context.Context) (uint64, error) {
|
func (ec *Client) BlockNumber(ctx context.Context) (uint64, error) {
|
||||||
var result hexutil.Uint64
|
var result hexutil.Uint64
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue