Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

fix: gas price returned in getTransaction api #1082

Merged
merged 2 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

* (cli) [tharsis#1086](https://github.com/tharsis/ethermint/pull/1086) Add rollback command.

### Bug Fixes

* (rpc) [tharsis#1082](https://github.com/tharsis/ethermint/pull/1082) fix gas price returned in getTransaction api.

## [v0.15.0] - 2022-05-09

### State Machine Breaking
Expand Down
9 changes: 7 additions & 2 deletions rpc/backend/evm_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransactio
common.Hash{},
uint64(0),
uint64(0),
b.chainID,
nil,
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -649,12 +649,17 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*types.RPCTransactio
return nil, errors.New("can't find index of ethereum tx")
}

baseFee, err := b.BaseFee(block.Block.Height)
if err != nil {
return nil, err
}

return types.NewTransactionFromMsg(
msg,
common.BytesToHash(block.BlockID.Hash.Bytes()),
uint64(res.Height),
txIndex,
b.chainID,
baseFee,
)
}

Expand Down
9 changes: 7 additions & 2 deletions rpc/namespaces/ethereum/eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -764,12 +764,17 @@ func (e *PublicAPI) getTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock,
msg = ethMsgs[i]
}

baseFee, err := e.backend.BaseFee(block.Block.Height)
if err != nil {
return nil, err
}

return rpctypes.NewTransactionFromMsg(
msg,
common.BytesToHash(block.Block.Hash()),
uint64(block.Block.Height),
uint64(idx),
e.chainIDEpoch,
baseFee,
)
}

Expand Down Expand Up @@ -983,7 +988,7 @@ func (e *PublicAPI) GetPendingTransactions() ([]*rpctypes.RPCTransaction, error)
common.Hash{},
uint64(0),
uint64(0),
e.chainIDEpoch,
nil,
)
if err != nil {
return nil, err
Expand Down