This commit is contained in:
Łukasz Magiera 2019-11-09 01:18:32 +01:00
parent 3b6c079014
commit 814e01cc05
2 changed files with 5 additions and 5 deletions

View File

@ -42,12 +42,12 @@ func (cs *ChainStore) Weight(ctx context.Context, ts *types.TipSet) (types.BigIn
return types.EmptyInt, xerrors.Errorf("All power in the net is gone. You network might be disconnected, or 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)) out.Add(out, big.NewInt(log2P<<8))
// (wFunction(totalPowerAtTipset(ts)) * len(ts.blocks) * wRatio_num * 2^8) / (e * wRatio_den) // (wFunction(totalPowerAtTipset(ts)) * len(ts.blocks) * wRatio_num * 2^8) / (e * wRatio_den)
eWeight := big.NewInt((log2P * int64(len(ts.Blocks())) * build.WRatioNum) << 8) eWeight := big.NewInt((log2P * int64(len(ts.Blocks())) * build.WRatioNum) << 8)
eWeight.Div(eWeight, big.NewInt(int64(build.BlocksPerEpoch * build.WRatioDen))) eWeight.Div(eWeight, big.NewInt(int64(build.BlocksPerEpoch*build.WRatioDen)))
out.Add(out, eWeight) out.Add(out, eWeight)
return types.BigInt{Int: out}, nil return types.BigInt{Int: out}, nil