mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-14 20:16:36 +00:00
internal/ethapi: fix panic in debug methods (#31157)
Fixes an error when the block is not found in debug methods.
This commit is contained in:
parent
cdb66c89d6
commit
da71839a27
1 changed files with 3 additions and 3 deletions
|
|
@ -1675,7 +1675,7 @@ func (api *DebugAPI) GetRawHeader(ctx context.Context, blockNrOrHash rpc.BlockNu
|
||||||
hash = h
|
hash = h
|
||||||
} else {
|
} else {
|
||||||
block, err := api.b.BlockByNumberOrHash(ctx, blockNrOrHash)
|
block, err := api.b.BlockByNumberOrHash(ctx, blockNrOrHash)
|
||||||
if err != nil {
|
if block == nil || err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
hash = block.Hash()
|
hash = block.Hash()
|
||||||
|
|
@ -1694,7 +1694,7 @@ func (api *DebugAPI) GetRawBlock(ctx context.Context, blockNrOrHash rpc.BlockNum
|
||||||
hash = h
|
hash = h
|
||||||
} else {
|
} else {
|
||||||
block, err := api.b.BlockByNumberOrHash(ctx, blockNrOrHash)
|
block, err := api.b.BlockByNumberOrHash(ctx, blockNrOrHash)
|
||||||
if err != nil {
|
if block == nil || err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
hash = block.Hash()
|
hash = block.Hash()
|
||||||
|
|
@ -1713,7 +1713,7 @@ func (api *DebugAPI) GetRawReceipts(ctx context.Context, blockNrOrHash rpc.Block
|
||||||
hash = h
|
hash = h
|
||||||
} else {
|
} else {
|
||||||
block, err := api.b.BlockByNumberOrHash(ctx, blockNrOrHash)
|
block, err := api.b.BlockByNumberOrHash(ctx, blockNrOrHash)
|
||||||
if err != nil {
|
if block == nil || err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
hash = block.Hash()
|
hash = block.Hash()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue