From a246be587e37a62675d0837edb3deb5da3bb8f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 13 Dec 2019 12:48:42 +0100 Subject: [PATCH] chainwatch: fix ui queries --- cmd/lotus-chainwatch/site/key.html | 2 +- cmd/lotus-chainwatch/templates.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/lotus-chainwatch/site/key.html b/cmd/lotus-chainwatch/site/key.html index 40ec02cb6..e6e5297e1 100644 --- a/cmd/lotus-chainwatch/site/key.html +++ b/cmd/lotus-chainwatch/site/key.html @@ -21,7 +21,7 @@ Messages: - {{ range messages "`from` = $1 or `to` = $2" $wallet $wallet $wallet}} + {{ range messages "\"from\" = $1 or \"to\" = $1" $wallet}} {{ if eq .From.String $wallet }} diff --git a/cmd/lotus-chainwatch/templates.go b/cmd/lotus-chainwatch/templates.go index b336953c5..4873bbcb1 100644 --- a/cmd/lotus-chainwatch/templates.go +++ b/cmd/lotus-chainwatch/templates.go @@ -153,10 +153,9 @@ func (h *handler) netPower(slashFilt string) (types.BigInt, error) { if slashFilt != "" { slashFilt = " where " + slashFilt } - return h.queryNum(`select sum(a.power) from ( - select max(miner_heads.power), miner_heads.slashed_at, height as power from miner_heads + return h.queryNum(`select sum(power) from (select distinct on (addr) power, slashed_at from miner_heads inner join blocks b on miner_heads.stateroot = b.parentStateRoot - group by miner_heads.addr) a` + slashFilt) +order by addr, height desc) as p` + slashFilt) } func (h *handler) queryNum(q string, p ...interface{}) (types.BigInt, error) { @@ -214,6 +213,8 @@ func (h *handler) messages(filter string, args ...interface{}) (out []types.Mess filter = " where " + filter } + log.Info("select * from messages "+filter) + rws, err := h.st.db.Query("select * from messages "+filter, args...) if err != nil { return nil, err
DirPeerNonceValueBlockMpool Wait
To{{.To.String}}