> net: limit BIP37 filter lifespan (active between 'filterload' and 'filterclear')
> Previously, a default match-everything bloom filter was set for every peer,
> i.e. even before receiving a 'filterload' message and after receiving a
> 'filterclear' message code branches checking for the existence of the filter
> by testing the pointer "pfilter" were _always_ executed.
> test: add more inactive filter tests to p2p_filter.py
> check the following expected behaviors if no filter is set:
> -> filtered block requests are ignored by the node
> -> sending a 'filteradd' message is treated as misbehavior
>
> also fixes a bug in the on_inv() callback method, which
> directly modified the type from BLOCK to FILTERED_BLOCK
> in the received 'inv' message rather than just for the reply
>
> Co-authored-by: MarcoFalke <falke.marco@gmail.com>
This is a backport of Core PR18544
I had to change the last test to use a different way to detect misbehavior, because banscore was deprecated in D8798 (this would have been applied in PR18672, if the backports had been done in sequential order)