getdata

getdata is used in response to inv, to retrieve the content of a specific object, and is usually sent after receiving an inv packet, after filtering known elements. It can be used to retrieve transactions, but only if they are in the memory pool or relay set - arbitrary access to transactions in the chain is not allowed to avoid having clients start to depend on nodes having full transaction indexes (which modern nodes do not).

Payload (maximum payload length: 1.8 Megabytes or 50000 entries)

I see the point in the code where the client enforces the 50000 entry limit. But where does it limit how large the payload is? It's not the send limit, that's 1 MiB. (by default) It's not the receive limit, that's 5 MiB.