mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-03 20:43:04 +02:00
lnwire: allow overriding of protocol messages outside of custom range
Add the ability to specify messages < CustomRangeStart that will still be treated like custom messages by lnd (rather than unknown ones). This allows code external to lnd to handle protocol messages that are *not yet known to lnd*.
This commit is contained in:
@@ -237,9 +237,16 @@ func makeEmptyMessage(msgType MessageType) (Message, error) {
|
||||
case MsgGossipTimestampRange:
|
||||
msg = &GossipTimestampRange{}
|
||||
default:
|
||||
if msgType < CustomTypeStart {
|
||||
// If the message is not within our custom range and has not
|
||||
// specifically been overridden, return an unknown message.
|
||||
//
|
||||
// Note that we do not allow custom message overrides to replace
|
||||
// known message types, only protocol messages that are not yet
|
||||
// known to lnd.
|
||||
if msgType < CustomTypeStart && !IsCustomOverride(msgType) {
|
||||
return nil, &UnknownMessage{msgType}
|
||||
}
|
||||
|
||||
msg = &Custom{
|
||||
Type: msgType,
|
||||
}
|
||||
|
Reference in New Issue
Block a user