It can be challenging to test P2P changes as tooling and functional tests are lacking. Often devs simply setup a new node with the patch and leave it for some time!?
Is there fuzzing for P2P messages yet?
SegWit was activated at block 481,824 in August 2017. Prior to activation, some very careful testing was carried out to verify different scenarios, for example:
How are transactions and blocks relayed between un-upgraded and upgraded nodes?
How do upgraded nodes find other upgraded nodes to connect to?
If a node is un-upgraded at activation time and subsequently upgrades, how does it ensure that the blocks that it previously validated (without segwit rules) are valid according to segwit rules?
To enable this kind of testing, PR#8418 made it possible to configure the segwit activation parameters using a
-bip9params configuration option. That configuration option was later renamed to
-vbparams in PR#10463, and replaced with
-segwitheight in PR#16060.
Those options allowed starting a node which would never activate segwit by passing
-vbparams=segwit:0:0 (or later,
-segwitheight=-1). This was used in the functional tests to test the node’s behaviour across activation.
The segwit mainnet activation was a one-time event. Now that segwit has been activated, those tests are no longer required.
PR#21090 removed the final tests that made use of
-segwitheight=0. With those tests removed, the special casing for
-segwitheight=-1 behaviour can also be removed. That special casing impacted logic in net_processing, validation and mining.