mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
Add Withdrawals struct (#6267)
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
use crate::EthPayloadBuilderAttributes;
|
||||
use alloy_rlp::{Encodable, Error as DecodeError};
|
||||
use reth_node_api::PayloadBuilderAttributes;
|
||||
use reth_primitives::{Address, TransactionSigned, Withdrawal, B256};
|
||||
use reth_primitives::{Address, TransactionSigned, Withdrawals, B256};
|
||||
use reth_rpc_types::engine::{OptimismPayloadAttributes, PayloadId};
|
||||
use reth_rpc_types_compat::engine::payload::convert_standalone_withdraw_to_withdrawal;
|
||||
|
||||
@ -39,10 +39,12 @@ impl PayloadBuilderAttributes for OptimismPayloadBuilderAttributes {
|
||||
|
||||
let withdraw = attributes.payload_attributes.withdrawals.map(
|
||||
|withdrawals: Vec<reth_rpc_types::withdrawal::Withdrawal>| {
|
||||
withdrawals
|
||||
.into_iter()
|
||||
.map(convert_standalone_withdraw_to_withdrawal) // Removed the parentheses here
|
||||
.collect::<Vec<_>>()
|
||||
Withdrawals::new(
|
||||
withdrawals
|
||||
.into_iter()
|
||||
.map(convert_standalone_withdraw_to_withdrawal) // Removed the parentheses here
|
||||
.collect(),
|
||||
)
|
||||
},
|
||||
);
|
||||
|
||||
@ -88,7 +90,7 @@ impl PayloadBuilderAttributes for OptimismPayloadBuilderAttributes {
|
||||
self.payload_attributes.prev_randao
|
||||
}
|
||||
|
||||
fn withdrawals(&self) -> &Vec<Withdrawal> {
|
||||
fn withdrawals(&self) -> &Withdrawals {
|
||||
&self.payload_attributes.withdrawals
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
use alloy_rlp::Encodable;
|
||||
use reth_node_api::{BuiltPayload, PayloadBuilderAttributes};
|
||||
use reth_primitives::{Address, BlobTransactionSidecar, SealedBlock, Withdrawal, B256, U256};
|
||||
use reth_primitives::{Address, BlobTransactionSidecar, SealedBlock, Withdrawals, B256, U256};
|
||||
use reth_rpc_types::engine::{
|
||||
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, ExecutionPayloadV1, PayloadAttributes,
|
||||
PayloadId,
|
||||
@ -153,7 +153,7 @@ pub struct EthPayloadBuilderAttributes {
|
||||
/// Randomness value for the generated payload
|
||||
pub prev_randao: B256,
|
||||
/// Withdrawals for the generated payload
|
||||
pub withdrawals: Vec<Withdrawal>,
|
||||
pub withdrawals: Withdrawals,
|
||||
/// Root of the parent beacon block
|
||||
pub parent_beacon_block_root: Option<B256>,
|
||||
}
|
||||
@ -174,10 +174,12 @@ impl EthPayloadBuilderAttributes {
|
||||
|
||||
let withdraw = attributes.withdrawals.map(
|
||||
|withdrawals: Vec<reth_rpc_types::withdrawal::Withdrawal>| {
|
||||
withdrawals
|
||||
.into_iter()
|
||||
.map(convert_standalone_withdraw_to_withdrawal) // Removed the parentheses here
|
||||
.collect::<Vec<_>>()
|
||||
Withdrawals::new(
|
||||
withdrawals
|
||||
.into_iter()
|
||||
.map(convert_standalone_withdraw_to_withdrawal) // Removed the parentheses here
|
||||
.collect(),
|
||||
)
|
||||
},
|
||||
);
|
||||
|
||||
@ -228,7 +230,7 @@ impl PayloadBuilderAttributes for EthPayloadBuilderAttributes {
|
||||
self.prev_randao
|
||||
}
|
||||
|
||||
fn withdrawals(&self) -> &Vec<Withdrawal> {
|
||||
fn withdrawals(&self) -> &Withdrawals {
|
||||
&self.withdrawals
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user