This adds a sendmsgtopeer
rpc (for testing only) that allows a node to send a message (provided in hex) to a peer.
While we would usually use a p2p
object instead of a node for this in the test framework, that isn’t possible in situations where this message needs to trigger an actual interaction of multiple nodes.
Use this rpc to add test coverage for the bug fixed in #27981 (that just got merged): The test lets two nodes (almost) simultaneously send a single large (4MB) p2p message to each other, which would have caused a deadlock previously (making this test fail), but succeeds now.
As can be seen from the discussion in #27981, it was not easy to reproduce this bug without sendmsgtopeer
. I would imagine that sendmsgtopeer
could also be helpful in various other test constellations.