Skip to content

Commit

Permalink
Merge pull request #101 from XinFinOrg/fix-committed-input
Browse files Browse the repository at this point in the history
Fix committed input
  • Loading branch information
wjrjerome authored Oct 25, 2023
2 parents 4bad837 + 1e3911d commit 9489158
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rpc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const (
)

// UnmarshalJSON parses the given JSON fragment into a BlockNumber. It supports:
// - "latest", "earliest" or "pending" as string arguments
// - "latest", "earliest", "pending" and "committed" as string arguments
// - the block number
// Returned errors:
// - an invalid block number error when the given argument isn't a known strings
Expand All @@ -99,6 +99,9 @@ func (bn *BlockNumber) UnmarshalJSON(data []byte) error {
case "pending":
*bn = PendingBlockNumber
return nil
case "committed":
*bn = CommittedBlockNumber
return nil
}

blckNum, err := hexutil.DecodeUint64(input)
Expand Down Expand Up @@ -157,6 +160,10 @@ func (bnh *BlockNumberOrHash) UnmarshalJSON(data []byte) error {
bn := PendingBlockNumber
bnh.BlockNumber = &bn
return nil
case "committed":
bn := CommittedBlockNumber
bnh.BlockNumber = &bn
return nil
default:
if len(input) == 66 {
hash := common.Hash{}
Expand Down

0 comments on commit 9489158

Please sign in to comment.