Improve logging of rejected transactions.

Rather than showing all errors from ProcessTransaction as a failure, check
if the error is a TxRuleError meaning the transaction was rejected as
opposed to something actually going wrong and log it accordingly.
This commit is contained in:
Dave Collins 2013-10-04 13:33:54 -05:00
parent 83ac359c51
commit 223d146a10

View file

@ -417,7 +417,15 @@ func (p *peer) handleTxMsg(msg *btcwire.MsgTx) {
// Process the transaction. // Process the transaction.
err = p.server.txMemPool.ProcessTransaction(msg) err = p.server.txMemPool.ProcessTransaction(msg)
if err != nil { if err != nil {
// When the error is a rule error, it means the transaction was
// simply rejected as opposed to something actually going wrong,
// so log it as such. Otherwise, something really did go wrong,
// so log it as an actual error.
if _, ok := err.(TxRuleError); ok {
log.Warnf("Rejected transaction %v: %v", hash, err)
} else {
log.Errorf("Failed to process transaction %v: %v", hash, err) log.Errorf("Failed to process transaction %v: %v", hash, err)
}
return return
} }
} }