Correction to the GraphViz function when drawing empty nodes
ToniRamirezM toni@iden3.com
Fri, 03 Jul 2020 18:07:33 +0200
1 files changed,
6 insertions(+),
1 deletions(-)
jump to
M
merkletree.go
→
merkletree.go
@@ -7,6 +7,7 @@ "errors"
"fmt" "io" "math/big" + "strings" "sync" "github.com/iden3/go-iden3-core/common"@@ -603,11 +604,15 @@ lr := [2]string{n.ChildL.BigInt().String(), n.ChildR.BigInt().String()}
for i := range lr { if lr[i] == "0" { lr[i] = fmt.Sprintf("empty%v", cnt) - fmt.Fprintf(w, "\"%v\" [style=dashed,label=0];\n", lr[i]) cnt++ } } fmt.Fprintf(w, "\"%v\" -> {\"%v\" \"%v\"}\n", k.BigInt().String(), lr[0], lr[1]) + for i := range lr { + if strings.HasPrefix(lr[i], "empty") { + fmt.Fprintf(w, "\"%v\" [style=dashed,label=0];\n", lr[i]) + } + } default: } })