|
|
|
@ -19,6 +19,7 @@ package rpc |
|
|
|
|
import ( |
|
|
|
|
"context" |
|
|
|
|
"encoding/json" |
|
|
|
|
"errors" |
|
|
|
|
"fmt" |
|
|
|
|
"math" |
|
|
|
|
"strings" |
|
|
|
@ -104,7 +105,7 @@ func (bn *BlockNumber) UnmarshalJSON(data []byte) error { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
if blckNum > math.MaxInt64 { |
|
|
|
|
return fmt.Errorf("block number larger than int64") |
|
|
|
|
return errors.New("block number larger than int64") |
|
|
|
|
} |
|
|
|
|
*bn = BlockNumber(blckNum) |
|
|
|
|
return nil |
|
|
|
@ -154,7 +155,7 @@ func (bnh *BlockNumberOrHash) UnmarshalJSON(data []byte) error { |
|
|
|
|
err := json.Unmarshal(data, &e) |
|
|
|
|
if err == nil { |
|
|
|
|
if e.BlockNumber != nil && e.BlockHash != nil { |
|
|
|
|
return fmt.Errorf("cannot specify both BlockHash and BlockNumber, choose one or the other") |
|
|
|
|
return errors.New("cannot specify both BlockHash and BlockNumber, choose one or the other") |
|
|
|
|
} |
|
|
|
|
bnh.BlockNumber = e.BlockNumber |
|
|
|
|
bnh.BlockHash = e.BlockHash |
|
|
|
@ -202,7 +203,7 @@ func (bnh *BlockNumberOrHash) UnmarshalJSON(data []byte) error { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
if blckNum > math.MaxInt64 { |
|
|
|
|
return fmt.Errorf("blocknumber too high") |
|
|
|
|
return errors.New("blocknumber too high") |
|
|
|
|
} |
|
|
|
|
bn := BlockNumber(blckNum) |
|
|
|
|
bnh.BlockNumber = &bn |
|
|
|
|