mirror of
https://github.com/LBRYFoundation/lbcd.git
synced 2025-08-23 17:47:24 +00:00
Improve RPC server log of rejected transactions.
Rather than showing all errors from ProcessTransaction as an error, 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
e76fada2d2
commit
b866e9f14c
1 changed files with 9 additions and 1 deletions
10
rpcserver.go
10
rpcserver.go
|
@ -606,7 +606,15 @@ func handleSendRawTransaction(s *rpcServer, cmd btcjson.Cmd, walletNotification
|
||||||
tx := btcutil.NewTx(msgtx)
|
tx := btcutil.NewTx(msgtx)
|
||||||
err = s.server.txMemPool.ProcessTransaction(tx)
|
err = s.server.txMemPool.ProcessTransaction(tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("RPCS: Failed to process transaction: %v", err)
|
// 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.Debugf("RPCS: Rejected transaction %v: %v", txHash, err)
|
||||||
|
} else {
|
||||||
|
log.Errorf("RPCS: Failed to process transaction %v: %v", txHash, err)
|
||||||
|
}
|
||||||
err = btcjson.Error{
|
err = btcjson.Error{
|
||||||
Code: btcjson.ErrDeserialization.Code,
|
Code: btcjson.ErrDeserialization.Code,
|
||||||
Message: "Failed to process transaction",
|
Message: "Failed to process transaction",
|
||||||
|
|
Loading…
Add table
Reference in a new issue