multi: explicitly signal final hop in pack hop payload

Previously, we'd use the value of nextChanID to infer whether a payload
was for the final hop in a route. This commit updates our packing logic
to explicitly signal to account for blinded routes, which allow zero
value nextChanID in intermediate hops. This is a preparatory commit
that allows us to more thoroughly validate payloads.
This commit is contained in:
Carla Kirk-Cohen
2023-11-01 10:46:48 -04:00
parent b5afd905d1
commit 585f28c5f5
3 changed files with 20 additions and 15 deletions

View File

@@ -121,7 +121,7 @@ func fuzzPayload(f *testing.F, finalPayload bool) {
var b bytes.Buffer
hop, nextChanID := hopFromPayload(payload1)
err = hop.PackHopPayload(&b, nextChanID)
err = hop.PackHopPayload(&b, nextChanID, finalPayload)
if errors.Is(err, route.ErrAMPMissingMPP) {
// PackHopPayload refuses to encode an AMP record
// without an MPP record. However, NewPayloadFromReader