core: use internal context for sending traces (#755)

This commit is contained in:
Manav Darji 2023-02-24 12:52:45 +05:30 committed by GitHub
parent 9859f2d43a
commit 4ca527255b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1388,7 +1388,7 @@ func (bc *BlockChain) writeBlockAndSetHead(ctx context.Context, block *types.Blo
var reorg bool var reorg bool
tracing.Exec(ctx, "blockchain.ReorgNeeded", func(_ context.Context, span trace.Span) { tracing.Exec(writeBlockAndSetHeadCtx, "blockchain.ReorgNeeded", func(_ context.Context, span trace.Span) {
reorg, err = bc.forker.ReorgNeeded(currentBlock.Header(), block.Header()) reorg, err = bc.forker.ReorgNeeded(currentBlock.Header(), block.Header())
tracing.SetAttributes( tracing.SetAttributes(
span, span,
@ -1402,7 +1402,7 @@ func (bc *BlockChain) writeBlockAndSetHead(ctx context.Context, block *types.Blo
return NonStatTy, err return NonStatTy, err
} }
tracing.Exec(ctx, "blockchain.reorg", func(_ context.Context, span trace.Span) { tracing.Exec(writeBlockAndSetHeadCtx, "blockchain.reorg", func(_ context.Context, span trace.Span) {
if reorg { if reorg {
// Reorganise the chain if the parent is not the head block // Reorganise the chain if the parent is not the head block
if block.ParentHash() != currentBlock.Hash() { if block.ParentHash() != currentBlock.Hash() {
@ -1431,7 +1431,7 @@ func (bc *BlockChain) writeBlockAndSetHead(ctx context.Context, block *types.Blo
// Set new head. // Set new head.
if status == CanonStatTy { if status == CanonStatTy {
tracing.Exec(ctx, "blockchain.writeHeadBlock", func(_ context.Context, _ trace.Span) { tracing.Exec(writeBlockAndSetHeadCtx, "blockchain.writeHeadBlock", func(_ context.Context, _ trace.Span) {
bc.writeHeadBlock(block) bc.writeHeadBlock(block)
}) })
} }