htlcswitch/hop/payload: extend tests to required type failures

This commit is contained in:
Conner Fromknecht committed 2019-10-30 21:20:49 -07:00
1 parent e85aaa45f6
commit 937b781276
2 files changed
+38 -5

No files matched your search

+23 -1
View File
@@ -98,7 +98,7 @@ var decodePayloadTests = []decodePayloadTest{
},
},
{
name: "required type zero",
name: "required type zero final hop",
payload: []byte{0x00, 0x00},
expErr: hop.ErrInvalidPayload{
Type: 0,
@@ -106,6 +106,28 @@ var decodePayloadTests = []decodePayloadTest{
FinalHop: true,
},
},
{
name: "required type zero final hop zero sid",
payload: []byte{0x00, 0x00, 0x06, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
},
expErr: hop.ErrInvalidPayload{
Type: 0,
Violation: hop.RequiredViolation,
FinalHop: true,
},
},
{
name: "required type zero intermediate hop",
payload: []byte{0x00, 0x00, 0x06, 0x08, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
},
expErr: hop.ErrInvalidPayload{
Type: 0,
Violation: hop.RequiredViolation,
FinalHop: false,
},
},
}
// TestDecodeHopPayloadRecordValidation asserts that parsing the payloads in the