-
Notifications
You must be signed in to change notification settings - Fork 889
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge: Backward sync re-org below TTD fix (#3696)
Signed-off-by: garyschulte <garyschulte@gmail.com>
- Loading branch information
1 parent
009c246
commit ae6c368
Showing
10 changed files
with
235 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...rge/src/main/java/org/hyperledger/besu/consensus/merge/TransitionBackwardSyncContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright Hyperledger Besu Contributors. | ||
* | ||
* 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.consensus.merge; | ||
|
||
import org.hyperledger.besu.ethereum.BlockValidator; | ||
import org.hyperledger.besu.ethereum.ProtocolContext; | ||
import org.hyperledger.besu.ethereum.core.Block; | ||
import org.hyperledger.besu.ethereum.eth.manager.EthContext; | ||
import org.hyperledger.besu.ethereum.eth.sync.backwardsync.BackwardSyncContext; | ||
import org.hyperledger.besu.ethereum.eth.sync.backwardsync.BackwardSyncLookupService; | ||
import org.hyperledger.besu.ethereum.eth.sync.state.SyncState; | ||
import org.hyperledger.besu.ethereum.storage.StorageProvider; | ||
import org.hyperledger.besu.plugin.services.MetricsSystem; | ||
|
||
public class TransitionBackwardSyncContext extends BackwardSyncContext { | ||
|
||
private final TransitionProtocolSchedule transitionProtocolSchedule; | ||
|
||
public TransitionBackwardSyncContext( | ||
final ProtocolContext protocolContext, | ||
final TransitionProtocolSchedule transitionProtocolSchedule, | ||
final MetricsSystem metricsSystem, | ||
final EthContext ethContext, | ||
final SyncState syncState, | ||
final BackwardSyncLookupService backwardSyncLookupService, | ||
final StorageProvider storageProvider) { | ||
super( | ||
protocolContext, | ||
transitionProtocolSchedule, | ||
metricsSystem, | ||
ethContext, | ||
syncState, | ||
backwardSyncLookupService, | ||
storageProvider); | ||
this.transitionProtocolSchedule = transitionProtocolSchedule; | ||
} | ||
|
||
/** | ||
* Choose the correct protocolSchedule and blockvalidator by block rather than number. This should | ||
* be used in the merge transition, specifically when the chain has not yet finalized. | ||
*/ | ||
@Override | ||
public BlockValidator getBlockValidatorForBlock(final Block block) { | ||
return transitionProtocolSchedule | ||
.getByBlockHeader(protocolContext, block.getHeader()) | ||
.getBlockValidator(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.