mulit: don't set customData on the lnrpc route level
We now make sure we only set the custom channel data in the lnrpc.Route only if it contains relevant data.
This commit is contained in:
1 parent
f35c295bd8
commit
cbfc0e0dc2
4 files changed
+26
-17
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package routerrpc
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
@@ -622,10 +623,26 @@ func (r *RouterBackend) MarshallRoute(route *route.Route) (*lnrpc.Route, error)
|
||||
// Allow the aux data parser to parse the custom records into
|
||||
// a human-readable JSON (if available).
|
||||
if r.ParseCustomChannelData != nil {
|
||||
// Store the original custom data to check if parsing
|
||||
// changed it.
|
||||
originalCustomData := make([]byte, len(customData))
|
||||
copy(originalCustomData, customData)
|
||||
|
||||
err := r.ParseCustomChannelData(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// We make sure we only set this field if the parser
|
||||
// changed the data otherwise we might mistakenly
|
||||
// show other tlv custom wire data as custom channel
|
||||
// data.
|
||||
if bytes.Equal(
|
||||
originalCustomData, resp.CustomChannelData,
|
||||
) {
|
||||
|
||||
resp.CustomChannelData = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user