mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 03:10:48 +00:00
internal/ethapi: prevent panic for pruned blocks
This commit is contained in:
parent
00cbd2e6f4
commit
6a600ed171
1 changed files with 4 additions and 0 deletions
|
|
@ -1446,6 +1446,10 @@ func (api *TransactionAPI) GetTransactionByHash(ctx context.Context, hash common
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if header == nil {
|
||||||
|
// header was pruned at this point
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
return newRPCTransaction(tx, blockHash, blockNumber, header.Time, index, header.BaseFee, api.b.ChainConfig()), nil
|
return newRPCTransaction(tx, blockHash, blockNumber, header.Time, index, header.BaseFee, api.b.ChainConfig()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue