fix a problem where the private world state is not found in GoQuorum mode (#2041)

* fix #2041

Signed-off-by: Joshua Fernandes <joshua.fernandes@consensys.net>
pull/2042/head
Stefan Pingel 4 years ago committed by Joshua Fernandes
parent a030235e3a
commit 6dc740e4ec
  1. 6
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/goquorum/GoQuorumBlockValidator.java
  2. 8
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/goquorum/GoQuorumPrivateStateUtil.java

@ -61,7 +61,11 @@ public class GoQuorumBlockValidator extends MainnetBlockValidator {
protected Result processBlock( protected Result processBlock(
final ProtocolContext context, final MutableWorldState worldState, final Block block) { final ProtocolContext context, final MutableWorldState worldState, final Block block) {
final MutableWorldState privateWorldState = final MutableWorldState privateWorldState =
getPrivateWorldState(goQuorumPrivateStorage, goQuorumWorldStateArchive, block.getHeader()); getPrivateWorldState(
goQuorumPrivateStorage,
goQuorumWorldStateArchive,
worldState.rootHash(),
block.getHash());
return ((GoQuorumBlockProcessor) blockProcessor) return ((GoQuorumBlockProcessor) blockProcessor)
.processBlock(context.getBlockchain(), worldState, privateWorldState, block); .processBlock(context.getBlockchain(), worldState, privateWorldState, block);

@ -37,15 +37,15 @@ public class GoQuorumPrivateStateUtil {
goQuorumPrivacyParameters.orElseThrow().privateStorage(); goQuorumPrivacyParameters.orElseThrow().privateStorage();
final WorldStateArchive goQuorumWorldStateArchive = final WorldStateArchive goQuorumWorldStateArchive =
goQuorumPrivacyParameters.orElseThrow().worldStateArchive(); goQuorumPrivacyParameters.orElseThrow().worldStateArchive();
return getPrivateWorldState(goQuorumPrivateStorage, goQuorumWorldStateArchive, header); return getPrivateWorldState(
goQuorumPrivateStorage, goQuorumWorldStateArchive, header.getStateRoot(), header.getHash());
} }
public static MutableWorldState getPrivateWorldState( public static MutableWorldState getPrivateWorldState(
final GoQuorumPrivateStorage goQuorumPrivateStorage, final GoQuorumPrivateStorage goQuorumPrivateStorage,
final WorldStateArchive goQuorumWorldStateArchive, final WorldStateArchive goQuorumWorldStateArchive,
final BlockHeader header) { final Hash worldStateRootHash,
final Hash worldStateRootHash = header.getStateRoot(); final Hash publicBlockHash) {
final Hash publicBlockHash = header.getHash();
final Hash privateStateRootHash = final Hash privateStateRootHash =
goQuorumPrivateStorage goQuorumPrivateStorage
.getPrivateStateRootHash(worldStateRootHash) .getPrivateStateRootHash(worldStateRootHash)

Loading…
Cancel
Save