diff --git a/packages/beacon-node/src/chain/prepareNextSlot.ts b/packages/beacon-node/src/chain/prepareNextSlot.ts index 0f5e4293934f..d7c29e8e227e 100644 --- a/packages/beacon-node/src/chain/prepareNextSlot.ts +++ b/packages/beacon-node/src/chain/prepareNextSlot.ts @@ -215,19 +215,18 @@ export class PrepareNextSlotScheduler { this.computeStateHashTreeRoot(updatedPrepareState, isEpochTransition); - // If emitPayloadAttributes is true emit a SSE payloadAttributes event + // If emitPayloadAttributes is true emit a SSE payloadAttributes event for + // every slot. Without the flag, only emit the event if we are proposing in the next slot. if ( - this.chain.opts.emitPayloadAttributes === true && + (feeRecipient || this.chain.opts.emitPayloadAttributes === true) && this.chain.emitter.listenerCount(routes.events.EventType.payloadAttributes) ) { const data = getPayloadAttributesForSSE(fork as ForkPostBellatrix, this.chain, { prepareState: updatedPrepareState, prepareSlot, - parentBlockRoot: fromHex(headRoot), + parentBlockRoot: fromHex(updatedHead.blockRoot), parentBlockHash, - // The likely consumers of this API are builders and will anyway ignore the - // feeRecipient, so just pass zero hash for now till a real use case arises - feeRecipient: "0x0000000000000000000000000000000000000000000000000000000000000000", + feeRecipient: feeRecipient ?? "0x0000000000000000000000000000000000000000", }); this.chain.emitter.emit(routes.events.EventType.payloadAttributes, {data, version: fork}); }