diff --git a/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java b/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java index a9a8f6fea57..27816335689 100644 --- a/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java @@ -67,6 +67,7 @@ import org.hyperledger.besu.ethereum.api.query.PrivacyQueries; import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator; import org.hyperledger.besu.ethereum.chain.Blockchain; +import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.MiningParameters; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Synchronizer; @@ -796,7 +797,8 @@ public Runner build() { .build(); vertx.deployVerticle(filterManager); - createPrivateTransactionObserver(filterManager, privacyParameters); + createPrivateTransactionObserver( + filterManager, privacyParameters, context.getBlockchain().getGenesisBlockHeader()); final P2PNetwork peerNetwork = networkRunner.getNetwork(); @@ -1032,7 +1034,8 @@ public Runner build() { DefaultAuthenticationService.create(vertx, webSocketConfiguration), metricsSystem)); - createPrivateTransactionObserver(subscriptionManager, privacyParameters); + createPrivateTransactionObserver( + subscriptionManager, privacyParameters, context.getBlockchain().getGenesisBlockHeader()); } final Optional metricsService = @@ -1344,7 +1347,8 @@ private void createLogsSubscriptionService( private void createPrivateTransactionObserver( final PrivateTransactionObserver privateTransactionObserver, - final PrivacyParameters privacyParameters) { + final PrivacyParameters privacyParameters, + final BlockHeader genesisBlockHeader) { // register privateTransactionObserver as observer of events fired by the flexible precompile. if (privacyParameters.isFlexiblePrivacyGroupsEnabled() && privacyParameters.isMultiTenancyEnabled()) { @@ -1352,9 +1356,10 @@ private void createPrivateTransactionObserver( (FlexiblePrivacyPrecompiledContract) besuController .getProtocolSchedule() - .getByBlockNumber(1) + .getByBlockHeader(genesisBlockHeader) .getPrecompileContractRegistry() .get(FLEXIBLE_PRIVACY); + flexiblePrivacyPrecompiledContract.addPrivateTransactionObserver(privateTransactionObserver); } }