Exemple #1
0
 def create_execution_context(
         cls, header: BlockHeaderAPI, prev_hashes: Iterable[Hash32],
         chain_context: ChainContextAPI) -> ExecutionContextAPI:
     fee_recipient = cls.consensus_class.get_fee_recipient(header)
     try:
         base_fee = header.base_fee_per_gas
     except AttributeError:
         return ExecutionContext(
             coinbase=fee_recipient,
             timestamp=header.timestamp,
             block_number=header.block_number,
             difficulty=header.difficulty,
             gas_limit=header.gas_limit,
             prev_hashes=prev_hashes,
             chain_id=chain_context.chain_id,
         )
     else:
         return ExecutionContext(
             coinbase=fee_recipient,
             timestamp=header.timestamp,
             block_number=header.block_number,
             difficulty=header.difficulty,
             gas_limit=header.gas_limit,
             prev_hashes=prev_hashes,
             chain_id=chain_context.chain_id,
             base_fee_per_gas=base_fee,
         )
Exemple #2
0
    def create_execution_context(
            self, prev_hashes: Tuple[Hash32, ...]) -> ExecutionContext:

        return ExecutionContext(
            coinbase=self.coinbase,
            timestamp=self.timestamp,
            block_number=self.block_number,
            difficulty=self.difficulty,
            gas_limit=self.gas_limit,
            prev_hashes=prev_hashes,
        )
Exemple #3
0
 def create_execution_context(
         header: BlockHeaderAPI, prev_hashes: Iterable[Hash32],
         chain_context: ChainContextAPI) -> ExecutionContextAPI:
     return ExecutionContext(
         coinbase=header.coinbase,
         timestamp=header.timestamp,
         block_number=header.block_number,
         difficulty=header.difficulty,
         gas_limit=header.gas_limit,
         prev_hashes=prev_hashes,
         chain_id=chain_context.chain_id,
     )
Exemple #4
0
    def create_execution_context(self,
                                 prev_hashes: Iterable[Hash32],
                                 chain_context: ChainContext) -> ExecutionContext:

        return ExecutionContext(
            coinbase=self.coinbase,
            timestamp=self.timestamp,
            block_number=self.block_number,
            difficulty=self.difficulty,
            gas_limit=self.gas_limit,
            prev_hashes=prev_hashes,
            chain_id=chain_context.chain_id,
        )
Exemple #5
0
    def create_execution_context(
            header: BlockHeaderAPI, prev_hashes: Iterable[Hash32],
            chain_context: ChainContext) -> ExecutionContext:

        # In Clique consensus, the tx fee goes to the signer
        try:
            coinbase = get_block_signer(header)
        except ValueError:
            coinbase = header.coinbase

        return ExecutionContext(
            coinbase=coinbase,
            timestamp=header.timestamp,
            block_number=header.block_number,
            difficulty=header.difficulty,
            gas_limit=header.gas_limit,
            prev_hashes=prev_hashes,
            chain_id=chain_context.chain_id,
        )