chainwatch: fix ui queries
This commit is contained in:
parent
f2ea12571f
commit
a246be587e
@ -21,7 +21,7 @@
|
||||
Messages:
|
||||
<table>
|
||||
<tr><td>Dir</td><td>Peer</td><td>Nonce</td><td>Value</td><td>Block</td><td>Mpool Wait</td></tr>
|
||||
{{ range messages "`from` = $1 or `to` = $2" $wallet $wallet $wallet}}
|
||||
{{ range messages "\"from\" = $1 or \"to\" = $1" $wallet}}
|
||||
<tr>
|
||||
{{ if eq .From.String $wallet }}
|
||||
<td>To</td><td>{{.To.String}}</td>
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user