Skip to content

Commit

Permalink
Calculate EIP1559 gas price in JSON-RPC (0xPolygon#1783)
Browse files Browse the repository at this point in the history
* Calculate EIP1559 gas price in JSON-RPC for compatibility with existing tools

* Fix cuddled return

---------

Co-authored-by: mchmatt <xxmattewxx@gmail.com>
  • Loading branch information
mchmatt and xxMattewxx authored Aug 8, 2023
1 parent 39f7d2b commit c4f9ec1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions jsonrpc/eth_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ func (e *Eth) GetTransactionByHash(hash types.Hash) (interface{}, error) {

// Find the transaction within the block
if txn, idx := types.FindTxByHash(block.Transactions, hash); txn != nil {
txn.GasPrice = txn.GetGasPrice(block.Header.BaseFee)

return toTransaction(
txn,
argUintPtr(block.Number()),
Expand Down
1 change: 1 addition & 0 deletions jsonrpc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ func toBlock(b *types.Block, fullTx bool) *block {

for idx, txn := range b.Transactions {
if fullTx {
txn.GasPrice = txn.GetGasPrice(b.Header.BaseFee)
res.Transactions = append(
res.Transactions,
toTransaction(
Expand Down

0 comments on commit c4f9ec1

Please sign in to comment.