Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,13 @@ public static BlockHeaderBuilder createPending(
final Bytes32 prevRandao = maybePrevRandao.orElse(null);
final Bytes32 parentBeaconBlockRoot = maybeParentBeaconBlockRoot.orElse(null);

// For PoS, coinbase is always configured, but for PoA it is not configured,
// rather generated for each block via MiningBeneficiaryCalculator.
// For simulation, if not configured, we use a dummy address 0x00.
// We don't throw an exception if coinbase is not configured.
return BlockHeaderBuilder.create()
.parentHash(parentHeader.getHash())
.coinbase(miningConfiguration.getCoinbase().orElseThrow())
.coinbase(miningConfiguration.getCoinbase().orElse(Address.ZERO))
.difficulty(difficulty)
.number(newBlockNumber)
.gasLimit(gasLimit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ protected BlockHeader overrideBlockHeader(
long timestamp = blockOverrides.getTimestamp().orElseThrow();
long blockNumber = blockOverrides.getBlockNumber().orElseThrow();

// For PoS, coinbase is always configured, but for PoA it is not configured,
// rather generated for each block via MiningBeneficiaryCalculator.
// For simulation, if not configured, we use a dummy address 0x00.
// We don't throw an exception if coinbase is not configured.
BlockHeaderBuilder builder =
BlockHeaderBuilder.createDefault()
.parentHash(header.getHash())
Expand All @@ -396,7 +400,7 @@ protected BlockHeader overrideBlockHeader(
.coinbase(
blockOverrides
.getFeeRecipient()
.orElseGet(() -> miningConfiguration.getCoinbase().orElseThrow()))
.orElseGet(() -> miningConfiguration.getCoinbase().orElse(Address.ZERO)))
.difficulty(
blockOverrides.getDifficulty().map(Difficulty::of).orElseGet(header::getDifficulty))
.gasLimit(
Expand Down