From adc01a8fd137866d000e0bfced0697d6b906f120 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Sat, 15 Apr 2023 02:31:30 +0200 Subject: [PATCH] fix(rpc): add missing v2 handler (#2261) --- crates/rpc/rpc-engine-api/src/engine_api.rs | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/crates/rpc/rpc-engine-api/src/engine_api.rs b/crates/rpc/rpc-engine-api/src/engine_api.rs index d6bba4bf5c..197d873643 100644 --- a/crates/rpc/rpc-engine-api/src/engine_api.rs +++ b/crates/rpc/rpc-engine-api/src/engine_api.rs @@ -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 /// /// 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 + pub async fn fork_choice_updated_v2( + &self, + state: ForkchoiceState, + payload_attrs: Option, + ) -> EngineApiResult { + 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. ///