Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rpc): fix nil pointer error in /tx and /tx_search (backport #3355) #3357

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
fix conflicts
  • Loading branch information
melekes committed Jun 28, 2024
commit 2f5ddbb04b8d6fe7fdf22e86fcf2fd93af0e0d53
10 changes: 0 additions & 10 deletions rpc/core/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,10 @@ func (env *Environment) Tx(_ *rpctypes.Context, hash []byte, prove bool) (*ctype

var proof types.TxProof
if prove {
<<<<<<< HEAD
block := env.BlockStore.LoadBlock(r.Height)
proof = block.Data.Txs.Proof(int(r.Index))
=======
block, _ := env.BlockStore.LoadBlock(r.Height)
if block != nil {
proof = block.Data.Txs.Proof(int(r.Index))
}
>>>>>>> 3d9bbb6f3 (fix(rpc): fix nil pointer error in `/tx` and `/tx_search` (#3355))
}

return &ctypes.ResultTx{
Expand Down Expand Up @@ -120,15 +115,10 @@ func (env *Environment) TxSearch(

var proof types.TxProof
if prove {
<<<<<<< HEAD
block := env.BlockStore.LoadBlock(r.Height)
proof = block.Data.Txs.Proof(int(r.Index))
=======
block, _ := env.BlockStore.LoadBlock(r.Height)
if block != nil {
proof = block.Data.Txs.Proof(int(r.Index))
}
>>>>>>> 3d9bbb6f3 (fix(rpc): fix nil pointer error in `/tx` and `/tx_search` (#3355))
}

apiResults = append(apiResults, &ctypes.ResultTx{
Expand Down
Loading