feat: add debug_getrawTransactions (#5682)

This commit is contained in:
Matthias Seitz
2023-12-04 19:27:57 +01:00
committed by GitHub
parent f15e878250
commit 73a5b6ced9
3 changed files with 39 additions and 2 deletions

View File

@ -187,11 +187,32 @@ pub trait BlockReaderIdExt: BlockReader + BlockIdReader + ReceiptProviderIdExt {
self.sealed_header_by_id(BlockNumberOrTag::Finalized.into())
}
/// Returns the block with the matching `BlockId` from the database.
/// Returns the block with the matching [BlockId] from the database.
///
/// Returns `None` if block is not found.
fn block_by_id(&self, id: BlockId) -> ProviderResult<Option<Block>>;
/// Returns the block with senders with matching [BlockId].
///
/// Returns the block's transactions in the requested variant.
///
/// Returns `None` if block is not found.
fn block_with_senders_by_id(
&self,
id: BlockId,
transaction_kind: TransactionVariant,
) -> ProviderResult<Option<BlockWithSenders>> {
match id {
BlockId::Hash(hash) => {
self.block_with_senders(hash.block_hash.into(), transaction_kind)
}
BlockId::Number(num) => self.convert_block_number(num)?.map_or_else(
|| Ok(None),
|num| self.block_with_senders(num.into(), transaction_kind),
),
}
}
/// Returns the header with matching tag from the database
///
/// Returns `None` if header is not found.