mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-29 09:08:05 -05:00
fix(rpc): add missing v2 handler (#2261)
This commit is contained in:
@@ -79,6 +79,9 @@ where
|
||||
Ok(rx.await??)
|
||||
}
|
||||
|
||||
/// Sends a message to the beacon consensus engine to update the fork choice _without_
|
||||
/// withdrawals.
|
||||
///
|
||||
/// See also <https://github.com/ethereum/execution-apis/blob/8db51dcd2f4bdfbd9ad6e4a7560aac97010ad063/src/engine/specification.md#engine_forkchoiceUpdatedV1>
|
||||
///
|
||||
/// Caution: This should not accept the `withdrawals` field
|
||||
@@ -103,6 +106,31 @@ where
|
||||
Ok(rx.await??)
|
||||
}
|
||||
|
||||
/// Sends a message to the beacon consensus engine to update the fork choice _with_ withdrawals,
|
||||
/// but only _after_ shanghai.
|
||||
///
|
||||
/// See also <https://github.com/ethereum/execution-apis/blob/main/src/engine/specification.md#engine_forkchoiceupdatedv2>
|
||||
pub async fn fork_choice_updated_v2(
|
||||
&self,
|
||||
state: ForkchoiceState,
|
||||
payload_attrs: Option<PayloadAttributes>,
|
||||
) -> EngineApiResult<ForkchoiceUpdated> {
|
||||
if let Some(ref attrs) = payload_attrs {
|
||||
self.validate_withdrawals_presence(
|
||||
EngineApiMessageVersion::V2,
|
||||
attrs.timestamp.as_u64(),
|
||||
attrs.withdrawals.is_some(),
|
||||
)?;
|
||||
}
|
||||
let (tx, rx) = oneshot::channel();
|
||||
self.to_beacon_consensus.send(BeaconEngineMessage::ForkchoiceUpdated {
|
||||
state,
|
||||
payload_attrs,
|
||||
tx,
|
||||
})?;
|
||||
Ok(rx.await??)
|
||||
}
|
||||
|
||||
/// Returns the most recent version of the payload that is available in the corresponding
|
||||
/// payload build process at the time of receiving this call.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user