Skip to content
Merged
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
12 changes: 9 additions & 3 deletions internal/blockchain/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ func checkTransactionContext(tx *wire.MsgTx, params *chaincfg.Params, flags Agen
isCoinBase = standalone.IsCoinBaseTx(tx, isTreasuryEnabled)
}

// Take action on type.
switch {
case isVote:
// Check script length of stake base signature.
Expand All @@ -454,10 +453,10 @@ func checkTransactionContext(tx *wire.MsgTx, params *chaincfg.Params, flags Agen
return ruleError(ErrBadStakebaseScrVal, str)
}

// The ticket reference hash in an SSGen tx must not be null.
// The referenced ticket in a vote must not be null.
ticketHash := &tx.TxIn[1].PreviousOutPoint
if isNullOutpoint(ticketHash) {
str := "vote ticket input refers to previous output that is null"
const str = "vote ticket input refers to null previous output"
return ruleError(ErrBadTxInput, str)
}

Expand All @@ -472,6 +471,13 @@ func checkTransactionContext(tx *wire.MsgTx, params *chaincfg.Params, flags Agen
return ruleError(ErrInvalidRevocationTxVersion, str)
}

// The referenced ticket in a revocation must not be null.
ticketHash := &tx.TxIn[0].PreviousOutPoint
if isNullOutpoint(ticketHash) {
const str = "revocation ticket input refers to null previous output"
return ruleError(ErrBadTxInput, str)
}

case isCoinBase:
// The referenced outpoint must be null.
if !isNullOutpoint(&tx.TxIn[0].PreviousOutPoint) {
Expand Down