Make engine_getPayloadV2 accept local block value

This commit is contained in:
Mark Mackey 2022-12-16 14:56:07 -06:00
parent 558367ab8c
commit 3a08c7634e
2 changed files with 11 additions and 2 deletions

View File

@ -760,7 +760,7 @@ impl HttpJsonRpc {
) -> Result<ExecutionPayload<T>, Error> { ) -> Result<ExecutionPayload<T>, Error> {
let params = json!([JsonPayloadIdRequest::from(payload_id)]); let params = json!([JsonPayloadIdRequest::from(payload_id)]);
let payload_v2: JsonExecutionPayloadV2<T> = self let response: JsonGetPayloadResponse<T> = self
.rpc_request( .rpc_request(
ENGINE_GET_PAYLOAD_V2, ENGINE_GET_PAYLOAD_V2,
params, params,
@ -768,7 +768,7 @@ impl HttpJsonRpc {
) )
.await?; .await?;
JsonExecutionPayload::V2(payload_v2).try_into_execution_payload(fork_name) JsonExecutionPayload::V2(response.execution_payload).try_into_execution_payload(fork_name)
} }
pub async fn get_blobs_bundle_v1<T: EthSpec>( pub async fn get_blobs_bundle_v1<T: EthSpec>(

View File

@ -324,6 +324,15 @@ impl<T: EthSpec> TryFrom<ExecutionPayload<T>> for JsonExecutionPayloadV2<T> {
} }
} }
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(bound = "T: EthSpec", rename_all = "camelCase")]
pub struct JsonGetPayloadResponse<T: EthSpec> {
pub execution_payload: JsonExecutionPayloadV2<T>,
// uncomment this when geth fixes its serialization
//#[serde(with = "eth2_serde_utils::u256_hex_be")]
//pub block_value: Uint256,
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct JsonWithdrawal { pub struct JsonWithdrawal {