multi: return parsed types from payload

To separate blinded route parsing from payload parsing, we need to
return the parsed types map so that we can properly validate blinded
data payloads against what we saw in the onion.
This commit is contained in:
Carla Kirk-Cohen committed 2024-04-03 08:52:25 -04:00
1 parent 1e6fae37f7
commit 2029a06918
4 files changed
+16 -11

No files matched your search

+3 -1
View File
@@ -106,11 +106,13 @@ func (r *sphinxHopIterator) HopPayload() (*Payload, error) {
// Otherwise, if this is the TLV payload, then we'll make a new stream
// to decode only what we need to make routing decisions.
case sphinx.PayloadTLV:
return NewPayloadFromReader(
payload, _, err := NewPayloadFromReader(
bytes.NewReader(r.processedPacket.Payload.Payload),
r.processedPacket.Action == sphinx.ExitNode,
)
return payload, err
default:
return nil, fmt.Errorf("unknown sphinx payload type: %v",
r.processedPacket.Payload.Type)