Compiling with the new weight func

This commit is contained in:
Łukasz Magiera
2019-10-15 14:31:34 +02:00
parent 7d471a6ce3
commit 29f26cb8d1
9 changed files with 52 additions and 22 deletions
+6 -2
View File
@@ -3,6 +3,7 @@ package hello
import (
"context"
"fmt"
"github.com/filecoin-project/go-lotus/chain/types"
"github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor"
@@ -26,7 +27,7 @@ func init() {
type Message struct {
HeaviestTipSet []cid.Cid
HeaviestTipSetWeight uint64
HeaviestTipSetWeight types.BigInt
GenesisHash cid.Cid
}
@@ -83,7 +84,10 @@ func (hs *Service) SayHello(ctx context.Context, pid peer.ID) error {
defer s.Close()
hts := hs.cs.GetHeaviestTipSet()
weight := hs.cs.Weight(hts)
weight, err := hs.cs.Weight(ctx, hts)
if err != nil {
return err
}
gen, err := hs.cs.GetGenesis()
if err != nil {
return err
+4
View File
@@ -160,3 +160,7 @@ func (a *ChainAPI) ChainGetGenesis(ctx context.Context) (*types.TipSet, error) {
return types.NewTipSet([]*types.BlockHeader{genb})
}
func (a *ChainAPI) ChainTipSetWeight(ctx context.Context, ts *types.TipSet) (types.BigInt, error) {
return a.Chain.Weight(ctx, ts)
}
-4
View File
@@ -226,7 +226,3 @@ func (a *StateAPI) StateListMiners(ctx context.Context, ts *types.TipSet) ([]add
func (a *StateAPI) StateListActors(ctx context.Context, ts *types.TipSet) ([]address.Address, error) {
return a.StateManager.ListAllActors(ctx, ts)
}
func (a *StateAPI) StateTipSetWeight(ctx context.Context, ts *types.TipSet) (types.BigInt, error) {
return a.Chain.Weight(ctx, ts)
}