mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(rpc): impl debug_getRawReceipts (#2059)
This commit is contained in:
@ -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