Reject invalid RTM coinbase dev rewards#38
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
rpcData.coinbasedevrewardcould be skipped as an output but itsvaluewould still inflate the pool payout and change the coinbase transaction version.Description
hasValidCoinbaseDevReward(rpcData)which usesvalidateCoinbaseDevReward()and throws on malformed dev-reward objects instead of silently returning false.generateTransactionOutputs()to accept ahasDevRewardflag and only addcoinbasedevreward.valueinto reward accounting when the dev reward has been validated.hasDevRewardstate for coinbase transaction version selection so the version matches the actual emitted outputs.tests/test.jsasserting that a malformedcoinbasedevreward.scriptpubkeycausesRtmBlockTemplate()to throw (Invalid coinbase dev reward).Testing
coinbasedevreward) and the stubbed tests passed (valid/absent succeed, malformed throws as expected).git diff --checkto ensure no whitespace/patch issues and it passed.npm testbut it was blocked by the environment/registry returning403 Forbiddenwhile fetching dependencies so full test suite could not be executed.node --test --test-reporter=spec tests/test.jsbut it failed in this environment due to the missing native addon build artifact (../build/Release/blocktemplate), so the full test run could not complete.Codex Task