This contains a more complete version of #9117, as well as the changes promised to @TheBlueMatt in #8708. They’re combined here because the PushMessage changes require that the SendVersion is sane. This will be my last time messing with PushMessage, and it’s nearing the end of the net changes needed outside of actual net code…
The changes here:
- Don’t send messages after fDisconnect is set. (feeler connections are a TODO exception).
- Don’t use CSerializeData for outgoing data, which incurred a memory_cleanse for each message. Messages aren’t secret, and going forward, if they are they’ll be encrypted.
- Add a thin, featureless serializer to turn any set of args into a byte vector.
- Add an go-between message maker so that CConnman sees only serialized messages for pushing.
- That means that the caller is now responsible for determining the node’s send version. That’s a good thing, it can now move to CNodeState as later step.
- CConnman attaches the header and hashes the byte vector. @jonasschnelli: This should be very easy to adapt to bip151. A new flag SERIALIZE_BIP151_ENCRYPTED or so can be added and used similar to SERIALIZE_TRANSACTION_NO_WITNESS.