Coverage Summary for Class: Blockchain (org.ethereum.core)
Class |
Blockchain$MockitoMock$1379928001 |
Blockchain$MockitoMock$1379928001$auxiliary$gFfbtNo1 |
Blockchain$MockitoMock$1379928001$auxiliary$ShzrhG3b |
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.core;
21
22 import co.rsk.core.BlockDifficulty;
23 import co.rsk.core.bc.BlockChainStatus;
24 import org.ethereum.db.BlockInformation;
25 import org.ethereum.db.TransactionInfo;
26
27 import javax.annotation.Nullable;
28 import java.util.List;
29
30 public interface Blockchain {
31
32 /**
33 * Get block by number from the best chain
34 * @param number - number of the block
35 * @return block by that number
36 */
37 Block getBlockByNumber(long number);
38
39 /**
40 * Get block by hash
41 * @param hash - hash of the block
42 * @return - bloc by that hash
43 */
44 Block getBlockByHash(byte[] hash);
45
46 /**
47 * Get total difficulty from the start
48 * and until the head of the chain
49 *
50 * @return - total difficulty
51 */
52 BlockDifficulty getTotalDifficulty();
53
54 /**
55 * @return - last added block from blockchain
56 */
57 Block getBestBlock();
58
59 long getSize();
60
61 ImportResult tryToConnect(Block block);
62
63 void setStatus(Block block, BlockDifficulty totalDifficulty);
64
65 BlockChainStatus getStatus();
66
67 @Nullable
68 TransactionInfo getTransactionInfo(byte[] hash);
69
70 byte[] getBestBlockHash();
71
72 List<Block> getBlocksByNumber(long blockNr);
73
74 void removeBlocksByNumber(long blockNr);
75
76 List<BlockInformation> getBlocksInformationByNumber(long number);
77
78 boolean hasBlockInSomeBlockchain(byte[] hash);
79 }