From 5d60da54a3f56654a39647df01a099413757be97 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 9bd69e436..774e6d9c6 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -4606,6 +4606,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.