Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go-kosu: update scaling methods to be consistent #243

Merged
merged 7 commits into from Aug 29, 2019

go-kosu: fix copy of big.Ints

  • Loading branch information
hrharder committed Aug 28, 2019
commit dfaf411aa7015acf750038a8b1b876ff901af176
@@ -77,7 +77,7 @@ func posterIterator(app *App, totalBalance *big.Int) func(string, *types.Poster)
// calculates a poster's period limit based on their balance and the total poster balance
func posterLimit(periodLimit uint64, posterBalance, totalBalance *big.Int) uint64 {
// copy periodLimit (pl), posterBalance (pb), totalBalance (tb)
var pl, pb, tb *big.Int
pl, pb, tb := &big.Int{}, &big.Int{}, &big.Int{}
This conversation was marked as resolved by gchaincl

This comment has been minimized.

Copy link
@gchaincl

gchaincl Aug 29, 2019

Contributor

what's the difference between this and using non-pointers ?

This comment has been minimized.

Copy link
@hrharder

hrharder Aug 29, 2019

Author Member

I wanted to be consistent in how I allocate the bigInts, and in the other method I use n := &big.Int{} rather than var n *big.Int.

I also want to be consistent and use big.Int only as pointers, as per the documentation, so it feels weird to do var n big.Int and then &n everywhere it gets used.

pl.SetUint64(periodLimit)
pb.Set(posterBalance)
tb.Set(totalBalance)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.