Unify error handling of GetTransactionSpecific #395

pull/530/head
Martin Boehm 2020-11-28 15:27:05 +01:00
parent fc267ed2f4
commit da1c0d762e
1 changed files with 3 additions and 0 deletions

View File

@ -975,6 +975,9 @@ func (s *PublicServer) apiTxSpecific(r *http.Request, apiVersion int) (interface
var err error
s.metrics.ExplorerViews.With(common.Labels{"action": "api-tx-specific"}).Inc()
tx, err = s.chain.GetTransactionSpecific(&bchain.Tx{Txid: txid})
if err == bchain.ErrTxNotFound {
return nil, api.NewAPIError(fmt.Sprintf("Transaction '%v' not found", txid), true)
}
return tx, err
}