mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add SealedBlock in reth-primitives-traits (#13735)
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
use crate::BeaconSidecarConfig;
|
||||
use alloy_consensus::{
|
||||
transaction::PooledTransaction, Signed, Transaction as _, TxEip4844WithSidecar,
|
||||
transaction::PooledTransaction, BlockHeader, Signed, Transaction as _, TxEip4844WithSidecar,
|
||||
};
|
||||
use alloy_primitives::B256;
|
||||
use alloy_rpc_types_beacon::sidecar::{BeaconBlobBundle, SidecarIterator};
|
||||
@ -8,7 +8,7 @@ use eyre::Result;
|
||||
use futures_util::{stream::FuturesUnordered, Future, Stream, StreamExt};
|
||||
use reqwest::{Error, StatusCode};
|
||||
use reth::{
|
||||
primitives::SealedBlockWithSenders,
|
||||
primitives::RecoveredBlock,
|
||||
providers::CanonStateNotification,
|
||||
transaction_pool::{BlobStoreError, TransactionPoolExt},
|
||||
};
|
||||
@ -97,10 +97,10 @@ where
|
||||
St: Stream<Item = CanonStateNotification> + Send + Unpin + 'static,
|
||||
P: TransactionPoolExt + Unpin + 'static,
|
||||
{
|
||||
fn process_block(&mut self, block: &SealedBlockWithSenders) {
|
||||
fn process_block(&mut self, block: &RecoveredBlock<reth::primitives::Block>) {
|
||||
let txs: Vec<_> = block
|
||||
.body()
|
||||
.transactions()
|
||||
.iter()
|
||||
.filter(|tx| tx.is_eip4844())
|
||||
.map(|tx| (tx.clone(), tx.blob_versioned_hashes().unwrap().len()))
|
||||
.collect();
|
||||
@ -195,17 +195,15 @@ where
|
||||
// handle reorged blocks
|
||||
for (_, block) in old.blocks().iter() {
|
||||
let txs: Vec<BlobTransactionEvent> = block
|
||||
.body()
|
||||
.transactions()
|
||||
.iter()
|
||||
.filter(|tx: &&reth::primitives::TransactionSigned| {
|
||||
tx.is_eip4844()
|
||||
})
|
||||
.filter(|tx| tx.is_eip4844())
|
||||
.map(|tx| {
|
||||
let transaction_hash = tx.hash();
|
||||
let block_metadata = BlockMetadata {
|
||||
block_hash: new.tip().block.hash(),
|
||||
block_number: new.tip().block.number,
|
||||
gas_used: new.tip().block.gas_used,
|
||||
block_hash: new.tip().hash(),
|
||||
block_number: new.tip().number(),
|
||||
gas_used: new.tip().gas_used(),
|
||||
};
|
||||
BlobTransactionEvent::Reorged(ReorgedBlob {
|
||||
transaction_hash,
|
||||
@ -231,7 +229,7 @@ where
|
||||
async fn fetch_blobs_for_block(
|
||||
client: reqwest::Client,
|
||||
url: String,
|
||||
block: SealedBlockWithSenders,
|
||||
block: RecoveredBlock<reth::primitives::Block>,
|
||||
txs: Vec<(reth::primitives::TransactionSigned, usize)>,
|
||||
) -> Result<Vec<BlobTransactionEvent>, SideCarError> {
|
||||
let response = match client.get(url).header("Accept", "application/json").send().await {
|
||||
|
||||
Reference in New Issue
Block a user