htlcswitch/hop: make unknown required type const
Currently we use the AMP record type, this allows us to change it easily as we add new known records. We also bump this to 0x0c instead of 0x0a.
This commit is contained in:
parent
82b4f11292
commit
135a0a9f7f
@ -10,6 +10,8 @@ import (
|
||||
"github.com/lightningnetwork/lnd/record"
|
||||
)
|
||||
|
||||
const testUnknownRequiredType = 0x10
|
||||
|
||||
type decodePayloadTest struct {
|
||||
name string
|
||||
payload []byte
|
||||
@ -82,20 +84,25 @@ var decodePayloadTests = []decodePayloadTest{
|
||||
},
|
||||
{
|
||||
name: "required type after omitted hop id",
|
||||
payload: []byte{0x02, 0x00, 0x04, 0x00, 0x0a, 0x00},
|
||||
payload: []byte{
|
||||
0x02, 0x00, 0x04, 0x00,
|
||||
testUnknownRequiredType, 0x00,
|
||||
},
|
||||
expErr: hop.ErrInvalidPayload{
|
||||
Type: 10,
|
||||
Type: testUnknownRequiredType,
|
||||
Violation: hop.RequiredViolation,
|
||||
FinalHop: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "required type after included hop id",
|
||||
payload: []byte{0x02, 0x00, 0x04, 0x00, 0x06, 0x08, 0x01, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00,
|
||||
payload: []byte{
|
||||
0x02, 0x00, 0x04, 0x00, 0x06, 0x08, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
testUnknownRequiredType, 0x00,
|
||||
},
|
||||
expErr: hop.ErrInvalidPayload{
|
||||
Type: 10,
|
||||
Type: testUnknownRequiredType,
|
||||
Violation: hop.RequiredViolation,
|
||||
FinalHop: false,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user