rpcserver: don't write any custom channel data if empty

This commit is contained in:
Oliver Gugger
2024-10-15 09:56:32 +02:00
parent ca3bde901e
commit 560b7286b5

View File

@@ -4613,6 +4613,11 @@ func encodeCustomChanData(lnChan *channeldb.OpenChannel) ([]byte, error) {
customOpenChanData := lnChan.CustomBlob.UnwrapOr(nil)
customLocalCommitData := lnChan.LocalCommitment.CustomBlob.UnwrapOr(nil)
// Don't write any custom data if both blobs are empty.
if len(customOpenChanData) == 0 && len(customLocalCommitData) == 0 {
return nil, nil
}
// We'll encode our custom channel data as two blobs. The first is a
// set of var bytes encoding of the open chan data, the second is an
// encoding of the local commitment data.