This is a reduced version of @sipa ’s #6421 that caps the size of the mempool, but this one just introduces a dumb policy that simply rejects all replacements for now. That policy can be replaced, by #6421 (a rebased version can be found at https://github.com/jtimon/bitcoin/tree/limitpool_rebased ) or something else when it’s properly tested.
This dumb policy is similar to the one we’re using for resolving conflicts in spends. That spending conflicts policy should be located in the same place because it is likely that there can be some synergies. For example, it would be also good to implement zeroconf-safe-RBF (also known as FSS-RBF), so that payers can increase the fees when they get their transactions stuck. For this reason, this includes #6416 (although we can make a version without that if many people are already buidling on top of #6421 and they think the rebase on top of https://github.com/jtimon/bitcoin/tree/limitpool_rebased is too painful).