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:
parent
83ac359c51
commit
223d146a10
1 changed files with 9 additions and 1 deletions
8
peer.go
8
peer.go
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue