refactor: dedicated blockchain insert errors (#2712)

This commit is contained in:
Matthias Seitz
2023-05-18 15:00:47 +02:00
committed by GitHub
parent 149cac060a
commit 8fee5d3e28
10 changed files with 401 additions and 126 deletions

View File

@@ -146,8 +146,15 @@ impl SealedBlock {
/// Seal sealed block with recovered transaction senders.
pub fn seal_with_senders(self) -> Option<SealedBlockWithSenders> {
let senders = self.senders()?;
Some(SealedBlockWithSenders { block: self, senders })
self.try_seal_with_senders().ok()
}
/// Seal sealed block with recovered transaction senders.
pub fn try_seal_with_senders(self) -> Result<SealedBlockWithSenders, Self> {
match self.senders() {
Some(senders) => Ok(SealedBlockWithSenders { block: self, senders }),
None => Err(self),
}
}
/// Unseal the block