Skip to content

mempool's addSender error message may be too verbose #4474

@hvanz

Description

@hvanz

The following error message may appear many times in a log:

2024-11-12T02:36:16.276 ERR Could not add sender to tx module=mempool tx=5046AA33917146F4AD4718301C9006449B6E6EC37CAE2929FC81637C7A7F889D sender=4fe295e4cfad69f1247ad85975c6fd87757195db err="transaction not found in mempool"

There are two instances in the code where this message is logged:

  1. The transaction is being added to the mempool, it's already in the cache but not in the mempool, probably because it never was added (it was invalid) or it got removed.
    • If addSender returns ErrTxNotFound, there's no real error here. So the logging message should not be displayed.
    • If addSender returns other kind of error (ErrTxAlreadyReceivedFromSender), then the error should be displayed.
  2. The transaction being added is valid, not in cache, and already in the mempool because the cache overflowed (#890). The node has received the transaction from a sender already in the senders list, so addSender returns ErrTxAlreadyReceivedFromSender.
    • There's already a Debug message for this situation. It should be changed to an Error message. This error is important because it shows that the cache is small.
    • Then the error from addSender is redundant. There's no need to display it.

Probably addSender should never return ErrTxNotFound: if there's no mempool entry when adding a sender, just return nil.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglogsAnything relating to loggingmempool

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions