Backport 7691
Moved the implementation of the mempool filter from the master.
Merge request to the master with added functionality.
Moved the implementation of the mempool filter from the master.
Merge request to the master with added functionality.