backport: merge bitcoin#19521, #22047, #21796, #21767, #24133, #24921, #27988, partial #24117, #24138, #27405 (assumeutxo: part 5)#5501
Conversation
|
This pull request has conflicts, please rebase. |
|
This pull request has conflicts, please rebase. |
|
This pull request has conflicts, please rebase. |
PastaPastaPasta
left a comment
There was a problem hiding this comment.
Seems fine, one question
knst
left a comment
There was a problem hiding this comment.
3 changes:
-
this: knst@1c71b08
-
this refactoring (optional, can be done as an extra PR): knst@0bfefaf
-
and document
block_subsidyin feature_coinstatsindex.py
|
A test failure occured because changes brought on by Remnants of earlier behaviour were still left over in |
PastaPastaPasta
left a comment
There was a problem hiding this comment.
utACK for merging via merge commit
Dash uses the height and difficulty of the previous block to calculate the subsidy for the current block... which in the case of the genesis block is block -1, which doesn't exist. Attempting in reading `pprev` which is will evaluate to a `nullptr`, so for any blocks <=0, we fetch the subsidy expected from block 0 from CChainParams.
It's highly unlikely the test will ever deal with chains with >4500 blocks, so only the subset of the subsidy logic that is needed to validate `gettxoutsetinfo` output has been included
…statsindex excludes: - 691d45f (portions)
…nd FastRandomContext::rand_uniform_delay
…asure durations includes: - fa1d804
abca5ef to
cc9dcdd
Compare
#5524) ## Issue being fixed or feature implemented Unlike bitcoin we are using PREVIOUS block in `GetBlockSubsidy()`. That creates special case for genesis block, because it doesn't have previous block. In this special case instead of calling `GetBlockSubsidy` should be used pre-calculated value. To avoid confusion for new code and simplify implementation, there's introduced a new method `GetBlockSubsidyPrev` that has other interface: it takes pointer `CBlockIndex* prev` in agruments instead pair of height + nbits. These changes are follow-up for #5501 ## What was done? Implemented new method `GetBlockSubsidyPrev()` and used instead of `GetBlockSubsidy` when it is more convenient. ## How Has This Been Tested? Run unit/functional tests. ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone --------- Co-authored-by: UdjinM6 <[email protected]>
Additional information