Update chainwatch
This commit is contained in:
parent
f17962182f
commit
a46296d340
@ -17,8 +17,8 @@
|
|||||||
{{$addr := .}}
|
{{$addr := .}}
|
||||||
<div>
|
<div>
|
||||||
<a href="key.html?w={{$addr}}">{{$addr}}</a>
|
<a href="key.html?w={{$addr}}">{{$addr}}</a>
|
||||||
<span><b>{{qstr "select count(distinct cid) from messages where \"from\"=?" $addr}}</b> outmsgs;</span>
|
<span><b>{{qstr "select count(distinct cid) from messages where \"from\"=$1" $addr}}</b> outmsgs;</span>
|
||||||
<span><b>{{qstr "select count(distinct cid) from messages where \"to\"=?" $addr}}</b> inmsgs</span>
|
<span><b>{{qstr "select count(distinct cid) from messages where \"to\"=$1" $addr}}</b> inmsgs</span>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -211,7 +210,7 @@ create table if not exists receipts
|
|||||||
|
|
||||||
create index if not exists receipts_msg_state_index
|
create index if not exists receipts_msg_state_index
|
||||||
on receipts (msg, state);
|
on receipts (msg, state);
|
||||||
|
/*
|
||||||
create table if not exists miner_heads
|
create table if not exists miner_heads
|
||||||
(
|
(
|
||||||
head text not null,
|
head text not null,
|
||||||
@ -300,7 +299,7 @@ create index if not exists deal_activations_activation_epoch_index
|
|||||||
|
|
||||||
create unique index if not exists deal_activations_deal_uindex
|
create unique index if not exists deal_activations_deal_uindex
|
||||||
on deal_activations (deal);
|
on deal_activations (deal);
|
||||||
|
*/
|
||||||
create table if not exists blocks_challenges
|
create table if not exists blocks_challenges
|
||||||
(
|
(
|
||||||
block text not null
|
block text not null
|
||||||
@ -442,7 +441,7 @@ func (st *storage) storeActors(actors map[address.Address]map[types.Actor]actorI
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (st *storage) storeMiners(miners map[minerKey]*minerInfo) error {
|
func (st *storage) storeMiners(miners map[minerKey]*minerInfo) error {
|
||||||
tx, err := st.db.Begin()
|
/*tx, err := st.db.Begin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -487,7 +486,8 @@ create temp table mh (like miner_heads excluding constraints) on commit drop;
|
|||||||
return xerrors.Errorf("actor put: %w", err)
|
return xerrors.Errorf("actor put: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return tx.Commit()
|
return tx.Commit()*/
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (st *storage) storeHeaders(bhs map[cid.Cid]*types.BlockHeader, sync bool) error {
|
func (st *storage) storeHeaders(bhs map[cid.Cid]*types.BlockHeader, sync bool) error {
|
||||||
@ -839,7 +839,7 @@ func (st *storage) storeMpoolInclusions(msgs []api.MpoolUpdate) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (st *storage) storeDeals(deals map[string]api.MarketDeal) error {
|
func (st *storage) storeDeals(deals map[string]api.MarketDeal) error {
|
||||||
tx, err := st.db.Begin()
|
/*tx, err := st.db.Begin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -932,7 +932,7 @@ func (st *storage) storeDeals(deals map[string]api.MarketDeal) error {
|
|||||||
if err := tx.Commit(); err != nil {
|
if err := tx.Commit(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,9 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
rice "github.com/GeertJohan/go.rice"
|
rice "github.com/GeertJohan/go.rice"
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
@ -243,6 +246,45 @@ func (h *handler) qstrs(q string, n int, p ...interface{}) ([]string, error) {
|
|||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type sbig types.BigInt
|
||||||
|
|
||||||
|
func (bi *sbig) Scan(value interface{}) error {
|
||||||
|
switch value := value.(type) {
|
||||||
|
case string:
|
||||||
|
i, ok := big.NewInt(0).SetString(value, 10)
|
||||||
|
if !ok {
|
||||||
|
if value == "<nil>" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return xerrors.Errorf("failed to parse bigint string: '%s'", value)
|
||||||
|
}
|
||||||
|
|
||||||
|
bi.Int = i
|
||||||
|
|
||||||
|
return nil
|
||||||
|
case int64:
|
||||||
|
bi.Int = big.NewInt(value).Int
|
||||||
|
return nil
|
||||||
|
default:
|
||||||
|
return xerrors.Errorf("non-string types unsupported: %T", value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type Message struct {
|
||||||
|
To address.Address
|
||||||
|
From address.Address
|
||||||
|
|
||||||
|
Nonce uint64
|
||||||
|
|
||||||
|
Value sbig
|
||||||
|
|
||||||
|
GasPrice sbig
|
||||||
|
GasLimit sbig
|
||||||
|
|
||||||
|
Method abi.MethodNum
|
||||||
|
Params []byte
|
||||||
|
}
|
||||||
|
|
||||||
func (h *handler) messages(filter string, args ...interface{}) (out []types.Message, err error) {
|
func (h *handler) messages(filter string, args ...interface{}) (out []types.Message, err error) {
|
||||||
if len(filter) > 0 {
|
if len(filter) > 0 {
|
||||||
filter = " where " + filter
|
filter = " where " + filter
|
||||||
@ -255,7 +297,7 @@ func (h *handler) messages(filter string, args ...interface{}) (out []types.Mess
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
for rws.Next() {
|
for rws.Next() {
|
||||||
var r types.Message
|
var r Message
|
||||||
var cs string
|
var cs string
|
||||||
|
|
||||||
if err := rws.Scan(
|
if err := rws.Scan(
|
||||||
@ -276,11 +318,21 @@ func (h *handler) messages(filter string, args ...interface{}) (out []types.Mess
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if c != r.Cid() {
|
tr := types.Message{
|
||||||
|
To: r.To,
|
||||||
|
From: r.From,
|
||||||
|
Nonce: r.Nonce,
|
||||||
|
Value: types.BigInt(r.Value),
|
||||||
|
GasPrice: types.BigInt(r.GasPrice),
|
||||||
|
GasLimit: types.BigInt(r.GasLimit),
|
||||||
|
Method: r.Method,
|
||||||
|
Params: r.Params,
|
||||||
|
}
|
||||||
|
if c != tr.Cid() {
|
||||||
log.Warn("msg cid doesn't match")
|
log.Warn("msg cid doesn't match")
|
||||||
}
|
}
|
||||||
|
|
||||||
out = append(out, r)
|
out = append(out, tr)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user