-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Implement the groundwork for enabling the LSP0 feauture bit.
The following is copied from LSP0 LDK
`LDK as of 0.0.114 requires that you create a delegating implementation of the RoutingMessageHandler trait in order to change the init and node_announcement feature bits for LSPS LSP implementations. You should implement a type that contains an instance of the LDK-provided P2PGossipSync object (or if you want something for more general use, itself contains an instance of another object with the RoutingMessageHandler), and whose implementation of RoutingMessageHandler simply forwards most of the function calls to the contained instance.
The only non-delegating functions would be provided_node_features and provided_init_features. The delegating function would call the corresponding function on the contained instance, then serialize the returned Features object via Writeable::encode. The serialized vector of bytes encodes the 16-bit big-endian length, followed by the feature bits vector. The feature bits vector needs to be extended to at least 92 bytes, packing 0x00 bytes at the front of the vector if its length is increased, and the byte at length - 92 should be ORed with 0x2. Then if the length was changed, the 16-bit big-endian length needs to be updated. The 16-bit big-endian length is concatenated with the feature bits vector, then fed into a Read object, then a new InitFeatures or NodeFeatures is Readable::read from the modified feature bits serialization vector.`
Some new automated tests will be required. If its possible to run the MessageHandlers independently then that should be sufficient otherwise the end to end smoke tests should be used (with the feature enabled).