sphinx: Introduce a runtest command to the onion tool

The `runtest` command takes a JSON onion spec, creates the onion and decodes
it with the provided private keys. It is fully configurable and can be used
for the test-vectors in the spec.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2019-02-21 11:36:16 +01:00
committed by Rusty Russell
parent b83d15ea4a
commit 660921a9dd
5 changed files with 249 additions and 40 deletions

View File

@@ -21,6 +21,12 @@
#define ROUTING_INFO_SIZE (FRAME_SIZE * NUM_MAX_FRAMES)
#define TOTAL_PACKET_SIZE (VERSION_SIZE + PUBKEY_SIZE + HMAC_SIZE + ROUTING_INFO_SIZE)
#if EXPERIMENTAL_FEATURES
#define MAX_FRAMES_PER_HOP (1 << 4)
#else
#define MAX_FRAMES_PER_HOP 1
#endif
struct onionpacket {
/* Cleartext information */
u8 version;
@@ -87,6 +93,7 @@ struct hop_data {
enum sphinx_payload_type {
SPHINX_V0_PAYLOAD = 0,
SPHINX_INVALID_PAYLOAD = 254,
SPHINX_RAW_PAYLOAD = 255,
};