Coverage Summary for Class: BlockStore (org.ethereum.db)

Class
BlockStore$MockitoMock$1446616293
BlockStore$MockitoMock$1446616293$auxiliary$elF6qQuc
BlockStore$MockitoMock$1446616293$auxiliary$KgD8xdBK
Total


1 /* 2  * This file is part of RskJ 3  * Copyright (C) 2017 RSK Labs Ltd. 4  * (derived from ethereumJ library, Copyright (c) 2016 <ether.camp>) 5  * 6  * This program is free software: you can redistribute it and/or modify 7  * it under the terms of the GNU Lesser General Public License as published by 8  * the Free Software Foundation, either version 3 of the License, or 9  * (at your option) any later version. 10  * 11  * This program is distributed in the hope that it will be useful, 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14  * GNU Lesser General Public License for more details. 15  * 16  * You should have received a copy of the GNU Lesser General Public License 17  * along with this program. If not, see <http://www.gnu.org/licenses/>. 18  */ 19  20 package org.ethereum.db; 21  22 import co.rsk.core.BlockDifficulty; 23 import co.rsk.db.RemascCache; 24 import org.ethereum.core.Block; 25 import org.ethereum.core.Bloom; 26  27 import javax.annotation.Nonnull; 28 import java.util.List; 29  30 /** 31  * @author Roman Mandeleil 32  * @since 08.01.2015 33  */ 34 public interface BlockStore extends RemascCache { 35  36  /** 37  * Gets the block hash by its index. 38  * When more than one block with the specified index exists (forks) 39  * the select the block which is ancestor of the branchBlockHash 40  */ 41  byte[] getBlockHashByNumber(long blockNumber, byte[] branchBlockHash); 42  43  Block getChainBlockByNumber(long blockNumber); 44  45  @Nonnull 46  List<Block> getChainBlocksByNumber(long blockNumber); 47  48  void removeBlock(Block block); 49  50  Block getBlockByHash(byte[] hash); 51  52  Block getBlockAtDepthStartingAt(long depth, byte[] hash); 53  54  boolean isBlockExist(byte[] hash); 55  56  List<byte[]> getListHashesEndWith(byte[] hash, long qty); 57  58  void saveBlock(Block block, BlockDifficulty cummDifficulty, boolean mainChain); 59  60  BlockDifficulty getTotalDifficultyForHash(byte[] hash); 61  62  Block getBestBlock(); 63  64  /** 65  * @return The highest block number stored. 66  * @throws IllegalStateException if the blockstore is empty. 67  */ 68  long getMaxNumber(); 69  70  /** 71  * @return The smallest block number stored. 72  * @throws IllegalStateException if the blockstore is empty. 73  */ 74  long getMinNumber(); 75  76  void flush(); 77  78  void reBranch(Block forkBlock); 79  80  List<BlockInformation> getBlocksInformationByNumber(long number); 81  82  boolean isEmpty(); 83  84  void close(); 85  86  Bloom bloomByBlockNumber(long blockNumber); 87  88  void rewind(long blockNumber); 89 }