Update types.go

This commit is contained in:
lupin17 2025-12-12 15:24:28 +01:00 committed by GitHub
parent 16f50285b7
commit f919f50293
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -78,8 +78,8 @@ const (
// - an out of range error when the given block number is either too little or too large // - an out of range error when the given block number is either too little or too large
func (bn *BlockNumber) UnmarshalJSON(data []byte) error { func (bn *BlockNumber) UnmarshalJSON(data []byte) error {
input := strings.TrimSpace(string(data)) input := strings.TrimSpace(string(data))
if len(input) >= 2 && input[0] == '"' && input[len(input)-1] == '"' { if n := len(input); n >= 2 && input[0] == '"' && input[n-1] == '"' {
input = input[1 : len(input)-1] input = input[1 : n-1]
} }
switch input { switch input {