Skip to content

Commit

Permalink
added comment for the isGreaterThanLatestBlockNum check
Browse files Browse the repository at this point in the history
  • Loading branch information
denniswon authored and Leo Chen committed May 25, 2020
1 parent d63893c commit 2f8b53b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/hmyapi/apiv1/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ func (s *PublicBlockChainAPI) isBeaconShard() error {
}

func (s *PublicBlockChainAPI) isBlockGreaterThanLatest(blockNum rpc.BlockNumber) error {
// rpc.BlockNumber is int64 (latest = -1. pending = -2) and currentBlockNum is uint64.
// Most straightfoward to make sure to return nil error for latest and pending block num
// since they are never greater than latest
if blockNum != rpc.PendingBlockNumber &&
blockNum != rpc.LatestBlockNumber &&
uint64(blockNum) > s.b.CurrentBlock().NumberU64() {
Expand Down

0 comments on commit 2f8b53b

Please sign in to comment.