Skip to content

Conversation

@countvonzero
Copy link

check nil before use

@countvonzero countvonzero requested a review from markya0616 April 3, 2018 00:23

func (c *ChainConfig) IsCasper(num *big.Int) bool {
return isForked(c.CasperBlock, num)
return c.CasperBlock != nil && isForked(c.CasperBlock, num)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to check nil again. isForked has already done it.

// isForked returns whether a fork scheduled at block s is active at the given head block.
func isForked(s, head *big.Int) bool {
	if s == nil || head == nil {
		return false
	}
	return s.Cmp(head) <= 0
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh! thanks. my debugging was wrong :P

@countvonzero countvonzero deleted the fix-is-casper branch April 18, 2018 02:07
yysung1123 pushed a commit that referenced this pull request Oct 24, 2025
## Why this should be merged

Allows `core/types/hashing.go` to be deleted from `coreth`.

## How this works

Exported function acts as a proxy for unexported upstream function.

## How this was tested

NA
yysung1123 pushed a commit that referenced this pull request Oct 24, 2025
#163 was removed by mistake in #162 so this re-adds it

Co-authored-by: Arran Schlosberg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants