common: make sphinx code ignorant of payload format.

Now "raw_payload" is always the complete string (including realm or length
bytes at the front).

This has several effects:
1. We can receive an decrypt an onion which is grossly malformed.
2. We can still hand this to the htlc_accepted hook.
3. We then fail it unless the htlc_accepted accepts it manually.
4. The createonion API now takes the raw payload, and does not know
   anything about "style".

The only caveat is that the sphinx code needs to know the payload
length: we have a call for that, which simply tells it to copy the
entire onion (and treat us as the final node) if it's invalid.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-12-05 20:36:28 +10:30
committed by Christian Decker
parent bb538a1862
commit f7ebbb2ec5
17 changed files with 544 additions and 513 deletions

View File

@@ -20,6 +20,7 @@ DEVTOOLS_COMMON_OBJS := \
common/hash_u5.o \
common/memleak.o \
common/node_id.o \
common/onion.o \
common/per_peer_state.o \
common/pseudorand.o \
common/json.o \