Skip to content

Commit

Permalink
Fixed BigInt helper in presence of nil *big.Int value
Browse files Browse the repository at this point in the history
This will now emit the same thing just like if the value would have been `big.NewInt(0)`.
  • Loading branch information
maoueh committed Apr 18, 2024
1 parent 2da7341 commit 58628e2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions firehose/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ func Hex(in []byte) string {
}

func BigInt(in *big.Int) string {
if in == nil {
// This returns the same as if in would have been `big.NewInt(0)`
return "."
}

return Hex(in.Bytes())
}

Expand Down

0 comments on commit 58628e2

Please sign in to comment.