From dd8642c43cf8488a86117f02d56d833d0b67abf3 Mon Sep 17 00:00:00 2001 From: steven004 Date: Fri, 1 Nov 2019 09:43:22 +0800 Subject: [PATCH] Omit double delaration --- chain/store/weight.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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