Skip to content

Commit a91b77b

Browse files
author
maggie-5miles
committed
api: fix bug in getTransactionByHash
1 parent f2694e4 commit a91b77b

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

api/cmt.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,13 @@ func (s *CmtRPCService) GetTransactionByHash(hash string) (*RPCTransaction, erro
191191
}
192192
// get transaction
193193
res, err := s.backend.GetLocalClient().Tx(bkey, false)
194-
errNotFound := fmt.Errorf("Tx (%X) not found", hash)
195-
if err != nil && err != errNotFound {
194+
if err == nil {
195+
return newRPCTransaction(res)
196+
}
197+
errNotFound := fmt.Sprintf("Tx (%X) not found", bkey)
198+
if err != nil && err.Error() != errNotFound {
196199
// error other than not found
197200
return nil, err
198-
} else {
199-
return newRPCTransaction(res)
200201
}
201202
// No finalized transaction, try to retrieve it from the pool
202203
unConfirmedTxs, err := core.UnconfirmedTxs(-1)

0 commit comments

Comments
 (0)