BadBlocks returns a list of the last 'bad blocks' that the client has seen on the network
()
| 1779 | |
| 1780 | // BadBlocks returns a list of the last 'bad blocks' that the client has seen on the network |
| 1781 | func (bc *BlockChain) BadBlocks() []*types.Block { |
| 1782 | blocks := make([]*types.Block, 0, bc.badBlocks.Len()) |
| 1783 | for _, hash := range bc.badBlocks.Keys() { |
| 1784 | if blk, exist := bc.badBlocks.Peek(hash); exist { |
| 1785 | block := blk.(*types.Block) |
| 1786 | blocks = append(blocks, block) |
| 1787 | } |
| 1788 | } |
| 1789 | return blocks |
| 1790 | } |
| 1791 | |
| 1792 | // addBadBlock adds a bad block to the bad-block LRU cache |
| 1793 | func (bc *BlockChain) addBadBlock(block *types.Block) { |
no test coverage detected