From d95a82416cc38dae39fbd1fe830b8528d68fc273 Mon Sep 17 00:00:00 2001 From: Marko Date: Mon, 25 Sep 2023 16:03:49 +0200 Subject: [PATCH] fix: recreate legacy behaviour for addresscodec (#17870) (cherry picked from commit a953f1d3384a484713b43a0365331df596c3ba65) --- codec/address/bech32_codec.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/codec/address/bech32_codec.go b/codec/address/bech32_codec.go index aaac921f35e..45e9d2c0117 100644 --- a/codec/address/bech32_codec.go +++ b/codec/address/bech32_codec.go @@ -46,6 +46,10 @@ func (bc Bech32Codec) StringToBytes(text string) ([]byte, error) { // BytesToString decodes bytes to text func (bc Bech32Codec) BytesToString(bz []byte) (string, error) { + if len(bz) == 0 { + return "", nil + } + text, err := bech32.ConvertAndEncode(bc.Bech32Prefix, bz) if err != nil { return "", err