mirror of https://github.com/hyperledger/besu
Simplify ProtocolContext creation (#7792)
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>pull/7877/head
parent
dc81641c58
commit
833a5ce5dd
@ -1,38 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright ConsenSys AG. |
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
|
||||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
|
||||||
* specific language governing permissions and limitations under the License. |
|
||||||
* |
|
||||||
* SPDX-License-Identifier: Apache-2.0 |
|
||||||
*/ |
|
||||||
package org.hyperledger.besu.ethereum; |
|
||||||
|
|
||||||
import org.hyperledger.besu.ethereum.chain.Blockchain; |
|
||||||
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; |
|
||||||
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive; |
|
||||||
|
|
||||||
/** The ConsensusContextFactory interface defines a method for creating a consensus context. */ |
|
||||||
@FunctionalInterface |
|
||||||
public interface ConsensusContextFactory { |
|
||||||
|
|
||||||
/** |
|
||||||
* Creates a consensus context with the given blockchain, world state archive, and protocol |
|
||||||
* schedule. |
|
||||||
* |
|
||||||
* @param blockchain the blockchain |
|
||||||
* @param worldStateArchive the world state archive |
|
||||||
* @param protocolSchedule the protocol schedule |
|
||||||
* @return the created consensus context |
|
||||||
*/ |
|
||||||
ConsensusContext create( |
|
||||||
Blockchain blockchain, |
|
||||||
WorldStateArchive worldStateArchive, |
|
||||||
ProtocolSchedule protocolSchedule); |
|
||||||
} |
|
@ -0,0 +1,24 @@ |
|||||||
|
/* |
||||||
|
* Copyright contributors to Besu. |
||||||
|
* |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||||
|
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||||
|
* specific language governing permissions and limitations under the License. |
||||||
|
* |
||||||
|
* SPDX-License-Identifier: Apache-2.0 |
||||||
|
*/ |
||||||
|
package org.hyperledger.besu.ethereum.core; |
||||||
|
|
||||||
|
import org.hyperledger.besu.ethereum.ConsensusContext; |
||||||
|
|
||||||
|
public class ConsensusContextFixture implements ConsensusContext { |
||||||
|
@Override |
||||||
|
public <C extends ConsensusContext> C as(final Class<C> klass) { |
||||||
|
return klass.cast(this); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue