|
26 | 26 | from hathor.execution_manager import non_critical_code |
27 | 27 | from hathor.feature_activation.feature import Feature |
28 | 28 | from hathor.nanocontracts.exception import NCInvalidSignature |
29 | | -from hathor.nanocontracts.execution import NCBlockExecutor |
| 29 | +from hathor.nanocontracts.execution import NCBlockExecutor, NCConsensusBlockExecutor |
30 | 30 | from hathor.profiler import get_cpu_profiler |
31 | 31 | from hathor.pubsub import HathorEvents |
32 | 32 | from hathor.transaction import BaseTransaction, Block, Transaction |
@@ -100,18 +100,25 @@ def __init__( |
100 | 100 | self.nc_storage_factory = nc_storage_factory |
101 | 101 | self.soft_voided_tx_ids = frozenset(soft_voided_tx_ids) |
102 | 102 |
|
103 | | - # Create NCBlockExecutor with all NC-related dependencies |
| 103 | + # Create NCBlockExecutor (pure) for execution |
104 | 104 | self._block_executor = NCBlockExecutor( |
105 | 105 | settings=settings, |
106 | 106 | runner_factory=runner_factory, |
107 | 107 | nc_storage_factory=nc_storage_factory, |
108 | | - nc_log_storage=nc_log_storage, |
109 | 108 | nc_calls_sorter=nc_calls_sorter, |
| 109 | + ) |
| 110 | + |
| 111 | + # Create NCConsensusBlockExecutor (with side effects) for consensus |
| 112 | + self._consensus_block_executor = NCConsensusBlockExecutor( |
| 113 | + settings=settings, |
| 114 | + block_executor=self._block_executor, |
| 115 | + nc_storage_factory=nc_storage_factory, |
| 116 | + nc_log_storage=nc_log_storage, |
110 | 117 | nc_exec_fail_trace=nc_exec_fail_trace, |
111 | 118 | ) |
112 | 119 |
|
113 | 120 | self.block_algorithm_factory = BlockConsensusAlgorithmFactory( |
114 | | - settings, self._block_executor, feature_service, |
| 121 | + settings, self._consensus_block_executor, feature_service, |
115 | 122 | ) |
116 | 123 | self.transaction_algorithm_factory = TransactionConsensusAlgorithmFactory() |
117 | 124 | self.nc_calls_sorter = nc_calls_sorter |
|
0 commit comments