diff --git a/mempool.go b/mempool.go index bc867b97a..83fe19054 100644 --- a/mempool.go +++ b/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