This PR improves existing and adds new test coverage for the -maxuploadtarget mechanism (feature_maxuploadtarget.py) in the following ways, one commit each:
verify the uploadtarget state via the
getnettotalsRPC (uploadtargetresult field): https://github.com/bitcoin/bitcoin/blob/160d23677ad799cf9b493eaa923b2ac080c3fb8e/src/rpc/net.cpp#L581-L582 Note that reaching the total limit (target_reached== True) always implies that the historical blocks serving limits is also reached (serve_historical_blocks== False), i.e. it's impossible that both flags are set to True.check for peer's specific disconnect reason (in this case,
"historical block serving limit reached, disconnect peer"): https://github.com/bitcoin/bitcoin/blob/160d23677ad799cf9b493eaa923b2ac080c3fb8e/src/net_processing.cpp#L2272-L2280add a test for a peer disconnect if the uploadtarget is reached and a
mempoolmessage is received (if bloom filters are enabled): https://github.com/bitcoin/bitcoin/blob/160d23677ad799cf9b493eaa923b2ac080c3fb8e/src/net_processing.cpp#L4755-L4763 Note that another reason for disconnect after receiving a MEMPOOL msg of a peer is if bloom filters are disabled on the node. This case is already covered in the functional testp2p_nobloomfilter_messages.py.