-
Notifications
You must be signed in to change notification settings - Fork 293
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
blockchain: check errors and remove ineffectual assignments. #689
Conversation
@@ -1044,7 +1044,6 @@ func Generate() (tests [][]TestInstance, err error) { | |||
// \-> b38(10) | |||
// | |||
// OP_CHECKMULTISIG counts for 20 sigops. | |||
tooManySigOps = repeatOpcode(txscript.OP_CHECKMULTISIG, maxBlockSigOps/20) |
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.
is this a bug?
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.
It looks like a merge artifact (yay merges...). Notice how this line is 100% the same as manySigOps
above. Either this line can be removed like this, or it can be kept and the line below updated to append to tooManySigOps
.
That said, I sort of think I'd prefer the latter since it won't break the test if the manySigOps
above is changed in the future.
blockchain/subsidy.go
Outdated
@@ -250,6 +250,9 @@ func BlockOneCoinbasePaysTokens(tx *dcrutil.Tx, | |||
// There should only be one address. | |||
_, addrs, _, err := | |||
txscript.ExtractPkScriptAddrs(txout.Version, txout.PkScript, params) | |||
if err != nil { | |||
return err |
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.
Probably the wrong error here, see how it returns a rule error below.
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.
Agreed. This should return a ruleError
.
Since this touches consensus code I want @davecgh and @marcopeereboom to give it a look before merging. |
@@ -1044,7 +1044,6 @@ func Generate() (tests [][]TestInstance, err error) { | |||
// \-> b38(10) | |||
// | |||
// OP_CHECKMULTISIG counts for 20 sigops. | |||
tooManySigOps = repeatOpcode(txscript.OP_CHECKMULTISIG, maxBlockSigOps/20) |
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.
It looks like a merge artifact (yay merges...). Notice how this line is 100% the same as manySigOps
above. Either this line can be removed like this, or it can be kept and the line below updated to append to tooManySigOps
.
That said, I sort of think I'd prefer the latter since it won't break the test if the manySigOps
above is changed in the future.
blockchain/chainio.go
Outdated
@@ -920,7 +920,6 @@ func deserializeUtxoEntry(serialized []byte) (*UtxoEntry, error) { | |||
stakeExtra := make([]byte, len(serialized[offset:])) | |||
copy(stakeExtra, serialized[offset:]) | |||
entry.stakeExtra = stakeExtra | |||
offset += len(serialized[offset:]) |
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.
I'd prefer to leave this. Even though it's technically not used, if any fields are added, removing this would cause the offset to be incorrect if it weren't added back, and it's pretty likely it would be missed.
@@ -1066,7 +1065,6 @@ func Generate() (tests [][]TestInstance, err error) { | |||
// ... -> b39(10) | |||
// \-> b40(11) | |||
// | |||
tooManySigOps = repeatOpcode(txscript.OP_CHECKMULTISIGVERIFY, maxBlockSigOps/20) |
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.
Same here as above. I think it would be less error prone to keep this line and change the line below to append to it.
blockchain/subsidy.go
Outdated
@@ -250,6 +250,9 @@ func BlockOneCoinbasePaysTokens(tx *dcrutil.Tx, | |||
// There should only be one address. | |||
_, addrs, _, err := | |||
txscript.ExtractPkScriptAddrs(txout.Version, txout.PkScript, params) | |||
if err != nil { | |||
return err |
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.
Agreed. This should return a ruleError
.
@@ -360,7 +360,6 @@ func TestCalcStakeVersionCorners(t *testing.T) { | |||
bc.bestNode = currentNode | |||
|
|||
} | |||
height += runCount |
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.
Is that right? It seems like it is needed.
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 is not used after.
No description provided.