Better handling of orphan transactions

This is an alternative to #4880

The second commit fixes a crashing bug I found when testing the rest of these commits.

The first is #4880. The third is a two-line change to remove orphans when a node is disconnected for any reason, rather than just because it is banned.

The fourth adds a -maxorphantx option, and drops the default maximum number of orphan transactions to store in memory from 10,000 to 100, which is much closer to the actual number of orphans at any time during normal operation. Lowering the maximum number of orphans stored reduces potential memory usage and mitigates a whole class of "make your node spend a lot of time validating invalid orphans" attacks.