Cherry-pick [commit](https://github.com/cometbft/cometbft/commit/16ffabc6f4b7c4940e36b66852cb37aaf6d208d7) applying the p2p bugfixes to v0.37.1.