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

chaingen: Update for deprecated subsidy params. #2928

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions blockchain/chaingen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,10 @@ func (g *Generator) calcFullSubsidy(blockHeight uint32) dcrutil.Amount {
// good tests which exercise that code, so it wouldn't make sense to use the
// same code to generate them.
func (g *Generator) calcPoWSubsidy(fullSubsidy dcrutil.Amount, blockHeight uint32, numVotes uint16) dcrutil.Amount {
powProportion := dcrutil.Amount(g.params.WorkRewardProportion)
totalProportions := dcrutil.Amount(g.params.TotalSubsidyProportions())
const (
davecgh marked this conversation as resolved.
Show resolved Hide resolved
powProportion = 6
totalProportions = 10
)
powSubsidy := (fullSubsidy * powProportion) / totalProportions
if int64(blockHeight) < g.params.StakeValidationHeight {
return powSubsidy
Expand All @@ -361,9 +363,11 @@ func (g *Generator) calcPoSSubsidy(heightVotedOn uint32) dcrutil.Amount {
return 0
}

const (
posProportion = 3
totalProportions = 10
)
fullSubsidy := g.calcFullSubsidy(heightVotedOn)
posProportion := dcrutil.Amount(g.params.StakeRewardProportion)
totalProportions := dcrutil.Amount(g.params.TotalSubsidyProportions())
return (fullSubsidy * posProportion) / totalProportions
}

Expand All @@ -374,8 +378,10 @@ func (g *Generator) calcPoSSubsidy(heightVotedOn uint32) dcrutil.Amount {
// good tests which exercise that code, so it wouldn't make sense to use the
// same code to generate them.
func (g *Generator) calcDevSubsidy(fullSubsidy dcrutil.Amount, blockHeight uint32, numVotes uint16) dcrutil.Amount {
devProportion := dcrutil.Amount(g.params.BlockTaxProportion)
totalProportions := dcrutil.Amount(g.params.TotalSubsidyProportions())
const (
devProportion = 1
totalProportions = 10
)
devSubsidy := (fullSubsidy * devProportion) / totalProportions
if int64(blockHeight) < g.params.StakeValidationHeight {
return devSubsidy
Expand Down