-
Notifications
You must be signed in to change notification settings - Fork 138
change(consensus): Refactor block::check::subsidy_is_valid()
#8719
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
Conversation
…tructs, splits them into pre/post NU6 funding streams, and adds them as a field on `testnet::Parameters`
…onversion logic with constraints. Minor refactors
…red Testnets, but that being okay since configured testnet parameters are checked when they're being built
…ams, updates the `miner_fees_are_valid()` and `subsidy_is_valid()` functions to check that the deferred pool contribution is valid and that there are no unclaimed block subsidies after NU6 activation, and adds some TODOs
…too, adds Mainnet/Testnet NU6 activation heights, fixes lints/compilation issue
064d266
to
cb039e3
Compare
…est_funding_stream_values()` to use a configured testnet with the post-NU6 Mainnet funding streams height range
f407928
to
fd76ec5
Compare
… unnecessary checks
fd76ec5
to
ecf2846
Compare
if height < slow_start_interval { | ||
unreachable!( | ||
"unsupported block height: callers should handle blocks below {:?}", | ||
slow_start_interval | ||
) | ||
} else if halving_div.count_ones() != 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
height < slow_start_interval
is checked in num_halvings()
(and was checked in halving_divisor()
before this change)
halving_div.count_ones() != 1
where halving_div
is 1 << num_halvings
should always be false if num_halvings <= 2
(and should have always been false before this change since it would return early if 1u64.checked_shl(num_halvings) == None
).
Closing this for now, it's easier to recreate than to maintain |
Motivation
This is an optional refactor of the
subsidy_is_valid()
function and could include other cleanups following the NU6 consensus rule changes.Depends-On: #8694.
Solution
num_halvings()
fnnum_halvings()
instead ofhalving_divisor()
insubsidy_is_valid()
Tests
Zebra has several vectors tests for this function.
PR Author's Checklist
PR Reviewer's Checklist