From 560b7286b560456bb175198dda3a138299988d25 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Tue, 15 Oct 2024 09:56:32 +0200 Subject: [PATCH] rpcserver: don't write any custom channel data if empty --- rpcserver.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rpcserver.go b/rpcserver.go index b042e79e3..d9fdb82bb 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -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.