-
Notifications
You must be signed in to change notification settings - Fork 20.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core,eth,internal: Added debug_getBadBlocks()
method
#3654
Conversation
When bad blocks are discovered, these are stored within geth. An RPC-endpoint makes them availablewithin the `debug` namespace. This feature makes it easier to discover network forks. ```
815392d
to
f9f81ff
Compare
core/blockchain.go
Outdated
headers := make([]BadBlockArgs, 0, bc.badBlocks.Len()) | ||
for _, hash := range bc.badBlocks.Keys() { | ||
if hdr, exist := bc.badBlocks.Peek(hash); exist { | ||
headers = append(headers, BadBlockArgs{hdr.(*types.Header).Hash(), hdr.(*types.Header)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe assign hdr.(*types.Header)
first so you don't need to type assert twice.
core/blockchain.go
Outdated
} | ||
return headers, nil | ||
} | ||
// Adds a 'bad lock' to the LRU |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change comment to addBadBlock adds a bad block to the bad-block LRU cache
.
Tested. Works very well. LGTM |
When bad blocks are discovered, these are stored within geth.
An RPC-endpoint makes them availablewithin the
debug
namespace. This feature makes it easier to discover network forks.
Example output: