Wouldn’t it be better to make the insertion conditional on txinfo.m_time <= now - UNCONDITIONAL_RELAY_DELAY
?
Yeah, I think that makes perfect sense, given there is no point in adding something to the filter if we are going to unconditionally serve it anyway.
Even then this approach seems like it can trigger false positives fairly easily, since the rolling bloom filter capacity is only 3500 txs?
It may indeed. I haven’t got my head around how to properly compute what are the odds of this happening though, given it feels like it depends on how often MEMPOOL
messages are sent to us, which may be unbounded (how many MEMPOOL
requests can we receive in a UNCONDITIONAL_RELAY_DELAY
period, and how full our mempool may be?). In any case, this feels detrimental for the peer implementing this behavior instead of for us (?)
Something I’m really wondering is why this is actually bound by INVENTORY_MAX_RECENT_RELAY (3500)
instead of by MAX_PEER_TX_ANNOUNCEMENTS (5000)
. It feels quite inconsistent that we are able to accept up to 5000 transaction announcements from someone but we are only able to remember the last 3500 that we have announced to someone(else).
I think what may make even more sense would be to reply to mempool messages only with transactions that fall into the txinfo.m_time <= now - UNCONDITIONAL_RELAY_DELAY
check, that way we don’t really have to add transactions to m_recently_announced_invs
here, and we are also discouraging peers bloating us with MEMPOOL
messages. As long as they have a filter set, any transaction that matches their filter will be announced to them anyway (h/t @sdaftuar). I guess this could be done as a followup if it makes sense.