mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-29 09:08:05 -05:00
feat(rpc): impl debug_getRawReceipts (#2059)
This commit is contained in:
@@ -26,6 +26,12 @@ impl Receipt {
|
||||
pub fn bloom_slow(&self) -> Bloom {
|
||||
logs_bloom(self.logs.iter())
|
||||
}
|
||||
|
||||
/// Calculates the bloom filter for the receipt and returns the [ReceiptWithBloom] container
|
||||
/// type.
|
||||
pub fn with_bloom(self) -> ReceiptWithBloom {
|
||||
self.into()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Receipt> for ReceiptWithBloom {
|
||||
|
||||
@@ -130,7 +130,7 @@ where
|
||||
DebugApiClient::raw_header(client, block_id).await.unwrap();
|
||||
DebugApiClient::raw_block(client, block_id).await.unwrap();
|
||||
DebugApiClient::raw_transaction(client, H256::default()).await.unwrap();
|
||||
assert!(is_unimplemented(DebugApiClient::raw_receipts(client, block_id).await.err().unwrap()));
|
||||
DebugApiClient::raw_receipts(client, block_id).await.unwrap();
|
||||
assert!(is_unimplemented(DebugApiClient::bad_blocks(client).await.err().unwrap()));
|
||||
}
|
||||
|
||||
|
||||
@@ -183,8 +183,18 @@ where
|
||||
}
|
||||
|
||||
/// Handler for `debug_getRawReceipts`
|
||||
async fn raw_receipts(&self, _block_id: BlockId) -> RpcResult<Vec<Bytes>> {
|
||||
Err(internal_rpc_err("unimplemented"))
|
||||
async fn raw_receipts(&self, block_id: BlockId) -> RpcResult<Vec<Bytes>> {
|
||||
let receipts = self.client.receipts_by_block(block_id).to_rpc_result()?.unwrap_or_default();
|
||||
let mut all_receipts = Vec::with_capacity(receipts.len());
|
||||
|
||||
for receipt in receipts {
|
||||
let mut buf = Vec::new();
|
||||
let receipt = receipt.with_bloom();
|
||||
receipt.encode(&mut buf);
|
||||
all_receipts.push(buf.into());
|
||||
}
|
||||
|
||||
Ok(all_receipts)
|
||||
}
|
||||
|
||||
/// Handler for `debug_getBadBlocks`
|
||||
|
||||
Reference in New Issue
Block a user