Modify apiTx to not to return spending txs by default

This commit is contained in:
Martin Boehm 2018-10-25 18:32:03 +02:00
parent d1176e17d1
commit ab3e1b6172

View File

@ -641,7 +641,15 @@ func (s *PublicServer) apiTx(r *http.Request) (interface{}, error) {
s.metrics.ExplorerViews.With(common.Labels{"action": "api-tx"}).Inc()
if i := strings.LastIndexByte(r.URL.Path, '/'); i > 0 {
txid := r.URL.Path[i+1:]
tx, err = s.api.GetTransaction(txid, true)
spendingTxs := false
p := r.URL.Query().Get("spending")
if len(p) > 0 {
spendingTxs, err = strconv.ParseBool(p)
if err != nil {
return nil, api.NewApiError("Parameter 'spending' cannot be converted to boolean", true)
}
}
tx, err = s.api.GetTransaction(txid, spendingTxs)
}
return tx, err
}