lnrpc: receive custom message
This commit is contained in:
16 files changed
+4406
-3836
No files matched your search
@@ -240,7 +240,7 @@ func TestMaxOutPointIndex(t *testing.T) {
|
||||
func TestEmptyMessageUnknownType(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
fakeType := MessageType(math.MaxUint16)
|
||||
fakeType := CustomTypeStart - 1
|
||||
if _, err := makeEmptyMessage(fakeType); err == nil {
|
||||
t.Fatalf("should not be able to make an empty message of an " +
|
||||
"unknown type")
|
||||
|
||||
+6
-1
@@ -233,7 +233,12 @@ func makeEmptyMessage(msgType MessageType) (Message, error) {
|
||||
case MsgGossipTimestampRange:
|
||||
msg = &GossipTimestampRange{}
|
||||
default:
|
||||
return nil, &UnknownMessage{msgType}
|
||||
if msgType < CustomTypeStart {
|
||||
return nil, &UnknownMessage{msgType}
|
||||
}
|
||||
msg = &Custom{
|
||||
Type: msgType,
|
||||
}
|
||||
}
|
||||
|
||||
return msg, nil
|
||||
|
||||
Reference in new issue
Block a user