Skip to content

Commit

Permalink
Cherry-pick changes from develop (#738)
Browse files Browse the repository at this point in the history
* Check if block is nil to prevent panic (#736)

* miner: use env for tracing instead of block object (#728)

---------

Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>
  • Loading branch information
manav2401 and dkeysil authored Feb 14, 2023
1 parent 22fa403 commit d9cc218
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,10 @@ func (s *PublicBlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context,
return nil, err
}

if block == nil {
return nil, errors.New("block not found")
}

receipts, err := s.b.GetReceipts(ctx, block.Hash())
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1314,9 +1314,9 @@ func (w *worker) commit(ctx context.Context, env *environment, interval func(),

tracing.SetAttributes(
span,
attribute.Int("number", int(block.Number().Uint64())),
attribute.String("hash", block.Hash().String()),
attribute.String("sealhash", w.engine.SealHash(block.Header()).String()),
attribute.Int("number", int(env.header.Number.Uint64())),
attribute.String("hash", env.header.Hash().String()),
attribute.String("sealhash", w.engine.SealHash(env.header).String()),
attribute.Int("len of env.txs", len(env.txs)),
attribute.Bool("error", err != nil),
)
Expand Down

0 comments on commit d9cc218

Please sign in to comment.