GetBadBlocks returns a list of the last 'bad blocks' that the client has seen on the network and returns them as a JSON list of block-hashes
(ctx context.Context)
| 345 | // GetBadBlocks returns a list of the last 'bad blocks' that the client has seen on the network |
| 346 | // and returns them as a JSON list of block-hashes |
| 347 | func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs, error) { |
| 348 | blocks := api.cpc.BlockChain().BadBlocks() |
| 349 | results := make([]*BadBlockArgs, len(blocks)) |
| 350 | |
| 351 | var err error |
| 352 | for i, block := range blocks { |
| 353 | results[i] = &BadBlockArgs{ |
| 354 | Hash: block.Hash(), |
| 355 | } |
| 356 | if rlpBytes, err := rlp.EncodeToBytes(block); err != nil { |
| 357 | results[i].RLP = err.Error() // Hacky, but hey, it works |
| 358 | } else { |
| 359 | results[i].RLP = fmt.Sprintf("0x%x", rlpBytes) |
| 360 | } |
| 361 | if results[i].Block, err = cpcapi.RPCMarshalBlock(block, true, true); err != nil { |
| 362 | results[i].Block = map[string]interface{}{"error": err.Error()} |
| 363 | } |
| 364 | } |
| 365 | return results, nil |
| 366 | } |
| 367 | |
| 368 | // StorageRangeResult is the result of a debug_storageRangeAt API call. |
| 369 | type StorageRangeResult struct { |
nothing calls this directly
no test coverage detected