Remove unneeded usage of fmt.Sprintf

This commit is contained in:
David Hill 2014-06-04 20:24:48 -04:00
parent 0acd038eb6
commit 7f825fd9bc

View file

@ -187,9 +187,7 @@ func checkPkScriptStandard(pkScript []byte, scriptClass btcscript.ScriptClass) e
// A standard multi-signature public key script must contain // A standard multi-signature public key script must contain
// from 1 to maxStandardMultiSigKeys public keys. // from 1 to maxStandardMultiSigKeys public keys.
if numPubKeys < 1 { if numPubKeys < 1 {
str := fmt.Sprintf("multi-signature script with no " + return TxRuleError("multi-signature script with no pubkeys")
"pubkeys")
return TxRuleError(str)
} }
if numPubKeys > maxStandardMultiSigKeys { if numPubKeys > maxStandardMultiSigKeys {
str := fmt.Sprintf("multi-signature script with %d "+ str := fmt.Sprintf("multi-signature script with %d "+
@ -202,9 +200,7 @@ func checkPkScriptStandard(pkScript []byte, scriptClass btcscript.ScriptClass) e
// least 1 signature and no more signatures than available // least 1 signature and no more signatures than available
// public keys. // public keys.
if numSigs < 1 { if numSigs < 1 {
str := fmt.Sprintf("multi-signature script with no " + return TxRuleError("multi-signature script with no signatures")
"signatures")
return TxRuleError(str)
} }
if numSigs > numPubKeys { if numSigs > numPubKeys {
str := fmt.Sprintf("multi-signature script with %d "+ str := fmt.Sprintf("multi-signature script with %d "+
@ -214,7 +210,7 @@ func checkPkScriptStandard(pkScript []byte, scriptClass btcscript.ScriptClass) e
} }
case btcscript.NonStandardTy: case btcscript.NonStandardTy:
return TxRuleError(fmt.Sprintf("non-standard script form")) return TxRuleError("non-standard script form")
} }
return nil return nil
@ -241,8 +237,7 @@ func checkTransactionStandard(tx *btcutil.Tx, height int64) error {
// The transaction must be finalized to be standard and therefore // The transaction must be finalized to be standard and therefore
// considered for inclusion in a block. // considered for inclusion in a block.
if !btcchain.IsFinalizedTransaction(tx, height, time.Now()) { if !btcchain.IsFinalizedTransaction(tx, height, time.Now()) {
str := fmt.Sprintf("transaction is not finalized") return TxRuleError("transaction is not finalized")
return TxRuleError(str)
} }
// Since extremely large transactions with a lot of inputs can cost // Since extremely large transactions with a lot of inputs can cost
@ -826,8 +821,7 @@ func (mp *txMemPool) maybeAcceptTransaction(tx *btcutil.Tx, isOrphan *bool, isNe
if txD, exists := txStore[*txHash]; exists && txD.Err == nil { if txD, exists := txStore[*txHash]; exists && txD.Err == nil {
for _, isOutputSpent := range txD.Spent { for _, isOutputSpent := range txD.Spent {
if !isOutputSpent { if !isOutputSpent {
str := fmt.Sprintf("transaction already exists") return TxRuleError("transaction already exists")
return TxRuleError(str)
} }
} }
} }