Make non-canoncial data pushes non-standard.
This commit makes use of the new btcscript.HasCanonicalPushes to enforce canonical data pushes for transactions that are considered standard. A canonical data push is one where the fewest number of bytes possible to encode the size of the data being pushed is used. This includes using the small integer opcodes for single byte data that can be represented directly.
This commit is contained in:
parent
cb1f3cf48c
commit
264c89099f
1 changed files with 10 additions and 0 deletions
10
mempool.go
10
mempool.go
|
@ -271,6 +271,16 @@ func checkTransactionStandard(tx *btcutil.Tx, height int64) error {
|
|||
"script is not push only", i)
|
||||
return TxRuleError(str)
|
||||
}
|
||||
|
||||
// Each transaction input signature script must only contain
|
||||
// canonical data pushes. A canonical data push is one where
|
||||
// the minimum possible number of bytes is used to represent
|
||||
// the data push as possible.
|
||||
if !btcscript.HasCanonicalPushes(txIn.SignatureScript) {
|
||||
str := fmt.Sprintf("transaction input %d: signature "+
|
||||
"script has a non-canonical data push", i)
|
||||
return TxRuleError(str)
|
||||
}
|
||||
}
|
||||
|
||||
// None of the output public key scripts can be a non-standard script or
|
||||
|
|
Loading…
Reference in a new issue