Skip to content

Commit

Permalink
Merge pull request #296 from OffchainLabs/fix-gethash-forpendingblk
Browse files Browse the repository at this point in the history
arbBlockHash for pending blocks should return latest block hash [NIT-2121]
  • Loading branch information
PlasmaPower authored Mar 18, 2024
2 parents 09ec05c + 8f491a0 commit 58a1245
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 58a1245

Please sign in to comment.