Skip to content

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented May 16, 2020

Currently CheckTxInputs rejections from the mempool are the only rejections that log directly and unconditionally to debug.log instead of leaving it to the caller. This has multiple issues:

  • A rejected RPC transaction will log a redundant failure reason to debug log. All other failures are merely reported to the RPC user.
  • A rejected p2p transaction will log the failure twice. Once with the MEMPOOLREJ flag, and once unconditionally.
  • A rejected orphan transaction will log no failure.

Fix all issues by simply returning the state to the caller, like it is done for all other rejections.

The patch includes whitespace fixups to highlight relevant parts of the codebase and simplify review.

@naumenkogs
Copy link
Contributor

utACK fa9f20b

LogPrint(BCLog::MEMPOOL, " invalid orphan tx %s\n", orphanHash.ToString());
LogPrint(BCLog::MEMPOOL, " invalid orphan tx %s from peer=%d. %s\n",
orphanHash.ToString(),
fromPeer,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we want to log the peer for?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes (and we already do, in the MaybePunishNodeForTx() call)

@rajarshimaitra
Copy link
Contributor

rajarshimaitra commented Jul 3, 2020

Concept ACK. Compiled and ran tests. fa9f20b

@DrahtBot
Copy link
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@jnewbery
Copy link
Contributor

code review ACK fa9f20b

@maflcko
Copy link
Member Author

maflcko commented Jul 14, 2020

re-run ci

@maflcko maflcko closed this Jul 14, 2020
@maflcko maflcko reopened this Jul 14, 2020
@maflcko maflcko merged commit b26d62c into bitcoin:master Jul 14, 2020
@maflcko maflcko deleted the 2005-logMempoolRej branch July 14, 2020 14:18
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jul 14, 2020
fa9f20b log: Properly log txs rejected from mempool (MarcoFalke)

Pull request description:

  Currently `CheckTxInputs` rejections from the mempool are the only rejections that log directly and unconditionally to debug.log instead of leaving it to the caller. This has multiple issues:

  * A rejected RPC transaction will log a redundant failure reason to debug log. All other failures are merely reported to the RPC user.
  * A rejected p2p transaction will log the failure twice. Once with the `MEMPOOLREJ` flag, and once unconditionally.
  * A rejected orphan transaction will log no failure.

  Fix all issues by simply returning the state to the caller, like it is done for all other rejections.

  The patch includes whitespace fixups to highlight relevant parts of the codebase and simplify review.

ACKs for top commit:
  naumenkogs:
    utACK fa9f20b
  rajarshimaitra:
    Concept ACK. Compiled and ran tests. `fa9f20b`
  jnewbery:
    code review ACK fa9f20b

Tree-SHA512: 86cc17b2a9239c01c4fc3f254ad48ee1d3883266966b9811030176338b9ac3deaea7ea5babfb8bbf739d7440154e30011fede8f9313175f199d4a062af6494f7
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Aug 31, 2021
Summary:
> Currently CheckTxInputs rejections from the mempool are the only rejections that log directly and unconditionally to debug.log instead of leaving it to the caller. This has multiple issues:
>
> - A rejected RPC transaction will log a redundant failure reason to debug log. All other failures are merely reported to the RPC user.
> - A rejected p2p transaction will log the failure twice. Once with the MEMPOOLREJ flag, and once unconditionally.
> - A rejected orphan transaction will log no failure.
>
> Fix all issues by simply returning the state to the caller, like it is done for all other rejections.

This is a backport of [[bitcoin/bitcoin#18990 | core#18990]]

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D9996
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants