Coverage Summary for Class: BlockResult (co.rsk.core.bc)
Class |
Class, %
|
Method, %
|
Line, %
|
BlockResult |
100%
(1/1)
|
100%
(8/8)
|
100%
(17/17)
|
1 /*
2 * This file is part of RskJ
3 * Copyright (C) 2017 RSK Labs Ltd.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 package co.rsk.core.bc;
20
21 import co.rsk.core.Coin;
22 import co.rsk.trie.Trie;
23 import org.ethereum.core.Block;
24 import org.ethereum.core.Transaction;
25 import org.ethereum.core.TransactionReceipt;
26
27 import java.util.Collections;
28 import java.util.List;
29
30 /**
31 * Created by ajlopez on 01/08/2016.
32 */
33 public class BlockResult {
34 public static final BlockResult INTERRUPTED_EXECUTION_BLOCK_RESULT = new BlockResult(
35 null,
36 Collections.emptyList(),
37 Collections.emptyList(),
38 0,
39 Coin.ZERO,
40 null
41 );
42
43 private final Block block;
44 private final List<Transaction> executedTransactions;
45 private final List<TransactionReceipt> transactionReceipts;
46 private final long gasUsed;
47 private final Coin paidFees;
48
49 // It is for optimizing switching between states. Instead of using the "stateRoot" field,
50 // which requires regenerating the trie, using the finalState field does not.
51 private final Trie finalState;
52
53 public BlockResult(
54 Block block,
55 List<Transaction> executedTransactions,
56 List<TransactionReceipt> transactionReceipts,
57 long gasUsed,
58 Coin paidFees,
59 Trie finalState) {
60 this.block = block;
61 this.executedTransactions = executedTransactions;
62 this.transactionReceipts = transactionReceipts;
63 this.gasUsed = gasUsed;
64 this.paidFees = paidFees;
65 this.finalState = finalState;
66 }
67
68 public Block getBlock() {
69 return block;
70 }
71
72 public List<Transaction> getExecutedTransactions() { return executedTransactions; }
73
74 public List<TransactionReceipt> getTransactionReceipts() {
75 return this.transactionReceipts;
76 }
77
78 public long getGasUsed() {
79 return this.gasUsed;
80 }
81
82 public Coin getPaidFees() {
83 return this.paidFees;
84 }
85
86 public Trie getFinalState() {
87 return this.finalState;
88 }
89 }