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

blockchain: remove impossible to hit ErrInvalidSSRtxInput. #1307

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
5 changes: 0 additions & 5 deletions blockchain/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,6 @@ const (
// be OP_SS* tagged, but it must be P2PKH or P2SH.
ErrSStxInScrType

// ErrInvalidSSRtxInput indicates that the input for the SSRtx was not from
// an SStx.
ErrInvalidSSRtxInput

// ErrSSRtxPayeesMismatch means that the number of payees in an SSRtx was
// not the same as the number of payees in the outputs of the input SStx.
ErrSSRtxPayeesMismatch
Expand Down Expand Up @@ -532,7 +528,6 @@ var errorCodeStrings = map[ErrorCode]string{
ErrSSGenSubsidy: "ErrSSGenSubsidy",
ErrSStxInImmature: "ErrSStxInImmature",
ErrSStxInScrType: "ErrSStxInScrType",
ErrInvalidSSRtxInput: "ErrInvalidSSRtxInput",
ErrSSRtxPayeesMismatch: "ErrSSRtxPayeesMismatch",
ErrSSRtxPayees: "ErrSSRtxPayees",
ErrTxSStxOutSpend: "ErrTxSStxOutSpend",
Expand Down
1 change: 0 additions & 1 deletion blockchain/error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ func TestErrorCodeStringer(t *testing.T) {
{ErrSSGenSubsidy, "ErrSSGenSubsidy"},
{ErrSStxInImmature, "ErrSStxInImmature"},
{ErrSStxInScrType, "ErrSStxInScrType"},
{ErrInvalidSSRtxInput, "ErrInvalidSSRtxInput"},
{ErrSSRtxPayeesMismatch, "ErrSSRtxPayeesMismatch"},
{ErrSSRtxPayees, "ErrSSRtxPayees"},
{ErrTxSStxOutSpend, "ErrTxSStxOutSpend"},
Expand Down
21 changes: 0 additions & 21 deletions blockchain/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -1529,15 +1529,6 @@ func CheckTransactionInputs(subsidyCache *SubsidyCache, tx *dcrutil.Tx, txHeight
return 0, ruleError(ErrMissingTxOut, str)
}

// While we're here, double check to make sure that the input
// is from an SStx. By doing so, you also ensure the first
// output is OP_SSTX tagged.
if utxoEntrySstx.TransactionType() != stake.TxTypeSStx {
errStr := fmt.Sprintf("Input transaction %v for SSRtx"+
" %v was not an SStx tx", txHash, sstxHash)
return 0, ruleError(ErrInvalidSSRtxInput, errStr)
}

minOutsSStx := ConvertUtxosToMinimalOutputs(utxoEntrySstx)
sstxPayTypes, sstxPkhs, sstxAmts, _, sstxRules, sstxLimits :=
stake.SStxStakeOutputInfo(minOutsSStx)
Expand Down Expand Up @@ -1581,18 +1572,6 @@ func CheckTransactionInputs(subsidyCache *SubsidyCache, tx *dcrutil.Tx, txHeight
return 0, ruleError(ErrSSRtxPayees, errStr)
}

// 2. Check to make sure that the second input was an OP_SSTX
// tagged output from the referenced SStx.
if txscript.GetScriptClass(utxoEntrySstx.ScriptVersionByIndex(0),
utxoEntrySstx.PkScriptByIndex(0)) !=
txscript.StakeSubmissionTy {
errStr := fmt.Sprintf("First SStx output in SStx %v "+
"referenced by SSGen %v should have been "+
"OP_SSTX tagged, but it was not", sstxHash,
txHash)
return 0, ruleError(ErrInvalidSSRtxInput, errStr)
}

// 3. Check to ensure that ticket maturity number of blocks
// have passed between the block the SSRtx plans to go into
// and the block in which the SStx was originally found in.
Expand Down