diff --git a/chain/store/weight.go b/chain/store/weight.go index 3f52112cb..999166f89 100644 --- a/chain/store/weight.go +++ b/chain/store/weight.go @@ -11,8 +11,6 @@ import ( ) var zero = types.NewInt(0) -var wRatio_num = build.WRatioNum -var wRatio_den = build.WRatioDen func (cs *ChainStore) Weight(ctx context.Context, ts *types.TipSet) (types.BigInt, error) { if ts == nil { @@ -41,15 +39,15 @@ func (cs *ChainStore) Weight(ctx context.Context, ts *types.TipSet) (types.BigIn log2P = int64(tpow.BitLen() - 1) } else { // Not really expect to be here ... - return types.EmptyInt, xerrors.Errorf("All power in the net is gone. The net is dead!") + return types.EmptyInt, xerrors.Errorf("All power in the net is gone. You network might be disconnected, or the net is dead!") } out.Add(out, big.NewInt(log2P << 8)) // (wFunction(totalPowerAtTipset(ts)) * len(ts.blocks) * wRatio_num * 2^8) / (e * wRatio_den) - eWeight := big.NewInt((log2P * int64(len(ts.Blocks())) * wRatio_num) << 8) - eWeight.Div(eWeight, big.NewInt(int64(build.BlocksPerEpoch * wRatio_den))) + eWeight := big.NewInt((log2P * int64(len(ts.Blocks())) * build.WRatioNum) << 8) + eWeight.Div(eWeight, big.NewInt(int64(build.BlocksPerEpoch * build.WRatioDen))) out.Add(out, eWeight) return types.BigInt{Int: out}, nil