pub const MAX_INV_PER_MAP: usize = 1000;
Expand description

The maximum number of inventory hashes we will track from a single peer.

§Security

This limits known memory denial of service attacks like https://invdos.net/ to a total of:

1000 inventory * 2 maps * 32-64 bytes per inventory = less than 1 MB
1000 inventory * 70 peers * 2 maps * 6-18 bytes per address = up to 3 MB

Since the inventory registry is an efficiency optimisation, which falls back to a random peer, we only need to track a small number of hashes for available inventory.

But we want to be able to track a significant amount of missing inventory, to limit queries for globally missing inventory.