From c1400375c15be94a39d8a7930be150781595ea63 Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Mon, 14 Dec 2020 13:18:26 +0100 Subject: [PATCH] remove unnecessary empty lines in PathToLeaf.String() (#349) --- CHANGELOG.md | 2 ++ proof_path.go | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a09f621c..e4bb0d857 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ - [\#347](https://github.com/cosmos/iavl/pull/347) Fix another integer overflow in `decodeBytes()` that can cause panics for certain inputs. The `ValueOp` and `AbsenceOp` proof decoders are vulnerable to this via malicious inputs since 0.15.0. +- [\#349](https://github.com/cosmos/iavl/pull/349) Fix spurious blank lines in `PathToLeaf.String()`. + ## 0.15.1 (December 13, 2020) ### Bug Fixes diff --git a/proof_path.go b/proof_path.go index c263ce640..86915a1b8 100644 --- a/proof_path.go +++ b/proof_path.go @@ -47,13 +47,13 @@ func (pl PathToLeaf) stringIndented(indent string) string { if len(pl) == 0 { return "empty-PathToLeaf" } - strs := make([]string, len(pl)) + strs := make([]string, 0, len(pl)) for i, pin := range pl { if i == 20 { - strs[i] = fmt.Sprintf("... (%v total)", len(pl)) + strs = append(strs, fmt.Sprintf("... (%v total)", len(pl))) break } - strs[i] = fmt.Sprintf("%v:%v", i, pin.stringIndented(indent+" ")) + strs = append(strs, fmt.Sprintf("%v:%v", i, pin.stringIndented(indent+" "))) } return fmt.Sprintf(`PathToLeaf{ %s %v