From f6a7775810eefebfb7902b9a4fafd738ebd3e747 Mon Sep 17 00:00:00 2001 From: gupadhyaya Date: Mon, 19 Aug 2024 10:58:29 +0400 Subject: [PATCH] fix nil marshal --- serialization.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/serialization.go b/serialization.go index 06928ac..6138bf3 100644 --- a/serialization.go +++ b/serialization.go @@ -34,6 +34,10 @@ func byteSlicesToTxs(bytes [][]byte) []Tx { // Marshal serializes a batch to a byte slice. func (batch *Batch) Marshal() ([]byte, error) { + var b []byte + if batch == nil { + return b, nil + } pb := batch.ToProto() return pb.Marshal() }