Skip to content

Commit

Permalink
arbBlockHash for pending blocks should return latest block hash [NIT-…
Browse files Browse the repository at this point in the history
…2121]
  • Loading branch information
ganeshvanahalli committed Mar 15, 2024
1 parent 09ec05c commit 8f491a0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1178,13 +1178,14 @@ func doCall(ctx context.Context, b Backend, args TransactionArgs, state *state.S
func updateHeaderForPendingBlocks(blockNrOrHash rpc.BlockNumberOrHash, header *types.Header) *types.Header {
if blockNrOrHash.BlockNumber != nil &&
*blockNrOrHash.BlockNumber == rpc.PendingBlockNumber {
headerCopy := *header
headerCopy := types.CopyHeader(header)
now := uint64(time.Now().Unix())
if now > headerCopy.Time {
headerCopy.Time = now
}
headerCopy.Number = new(big.Int).Add(headerCopy.Number, common.Big1)
return &headerCopy
headerCopy.ParentHash = header.Hash()
return headerCopy
}
return header
}
Expand Down

0 comments on commit 8f491a0

Please sign in to comment.