From cf917fc4266b44452b212793930deb1a399cd8ab Mon Sep 17 00:00:00 2001 From: Mike Greenberg Date: Mon, 20 Jul 2020 17:31:27 -0400 Subject: [PATCH] fix(chainwatch): Restore base block reward metric capture --- cmd/lotus-chainwatch/processor/reward.go | 7 ++----- cmd/lotus-chainwatch/syncer/sync.go | 13 ++++++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/lotus-chainwatch/processor/reward.go b/cmd/lotus-chainwatch/processor/reward.go index a767b7e78..fb628bd6f 100644 --- a/cmd/lotus-chainwatch/processor/reward.go +++ b/cmd/lotus-chainwatch/processor/reward.go @@ -118,11 +118,8 @@ func (p *Processor) processRewardActors(ctx context.Context, rewardTips ActorTip return nil, xerrors.Errorf("unmarshal state (@ %s): %w", rw.common.stateroot.String(), err) } - // TODO: Resolve Actor API shift - //rw.baseBlockReward = rewardActorState.LastPerEpochReward - //rw.baselinePower = rewardActorState.BaselinePower - rw.baseBlockReward = big.Zero() - rw.baselinePower = big.Zero() + rw.baseBlockReward = rewardActorState.ThisEpochReward + rw.baselinePower = rewardActorState.ThisEpochBaselinePower out = append(out, rw) } } diff --git a/cmd/lotus-chainwatch/syncer/sync.go b/cmd/lotus-chainwatch/syncer/sync.go index 6a9bdc350..db82631e9 100644 --- a/cmd/lotus-chainwatch/syncer/sync.go +++ b/cmd/lotus-chainwatch/syncer/sync.go @@ -110,7 +110,8 @@ create table if not exists blocks miner text not null, timestamp bigint not null, ticket bytea not null, - eprof bytea, + election_proof bytea, + win_count bigint, forksig bigint not null ); @@ -401,15 +402,16 @@ create temp table b (like blocks excluding constraints) on commit drop; } } - stmt2, err := tx.Prepare(`copy b (cid, parentWeight, parentStateRoot, height, miner, "timestamp", ticket, eprof, forksig) from stdin`) + stmt2, err := tx.Prepare(`copy b (cid, parentWeight, parentStateRoot, height, miner, "timestamp", ticket, election_proof, win_count, forksig) from stdin`) if err != nil { return err } for _, bh := range bhs { - var eprof interface{} + var eproof, winCount interface{} if bh.ElectionProof != nil { - eprof = bh.ElectionProof.VRFProof + eproof = bh.ElectionProof.VRFProof + winCount = bh.ElectionProof.WinCount } if bh.Ticket == nil { @@ -428,7 +430,8 @@ create temp table b (like blocks excluding constraints) on commit drop; bh.Miner.String(), bh.Timestamp, bh.Ticket.VRFProof, - eprof, + eproof, + winCount, bh.ForkSignaling); err != nil { log.Error(err) }