Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
single-shot, sender-side mpp via sendtoroute #3442
This PR lays some more groundwork for our road to MPP payments in lnd. Here we add the ability to send MPP shards from the sender-side via
Apart from verifying that mpp records are not received at intermediate hops, the receiver does not perform any additional validation of the actual fields contained within. The receiver side has been modified to deliver these values all the way down to the invoice registry, but they are not inspected. Thus, the receiver will process the payment as they would a traditional payment. The additional behavior to enforce the MPP fields will be added in #3415, at which point the behaviors will diverge.
For now, the integration tests have been expanded to cover the three send to route endpoints
joostjager left a comment
I also experienced that the onion blob decryption code needs to be moved out of
Discussed offline. Plan is to move decryption (
These encoders can be composed to create composite types without incurring additional allocations that would be required to pass the truncated types through the generic interface.
This commit add mpp_total_amt_msat and mpp_payment_addr to the Hop message. Doing so enables users submitting mpp payments via rpc to set these parameters for the destination. In addition, it will allow us to display these fields in rpc responses.
This commit parses mpp_total_amt_msat and mpp_payment_addr from the SendToRoute rpc and populates an MPP record on the internal hop reprsentation. When the router goes to encode the onion packet, these fields will be serialized for the destination. We also populate the mpp fields when marshalling routes in rpc responses.
In this commit, we refactor the testSingleHopSendToRoute test to support table driven tests for various endpoints and payment types. Currently only the main rpcserver's SendToRoute is tested, so we also add support the SendToRouteSync and the routerrpc's SendToRoute. The tests are also modified to have each endpoint perform a single-hop, single-shot MPP payment. This asserts that the Hop messages are being properly unmarshalled and that setting correctly yields a successful payment. At the momemnt the receiver does not actually verify or use the MPP fields presented in the onion, though this test will be expanded later as those pieces are assembled.