From ab3e1b617295e120b4298bf390ef3625f9b29129 Mon Sep 17 00:00:00 2001 From: Martin Boehm Date: Thu, 25 Oct 2018 18:32:03 +0200 Subject: [PATCH] Modify apiTx to not to return spending txs by default --- server/public.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/public.go b/server/public.go index 34428785..644aa207 100644 --- a/server/public.go +++ b/server/public.go @@ -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 }