mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: always recover senders on mismatch (#5575)
This commit is contained in:
@ -57,10 +57,16 @@ impl Block {
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// If the number of senders does not match the number of transactions in the block.
|
||||
/// If the number of senders does not match the number of transactions in the block
|
||||
/// and the signer recovery for one of the transactions fails.
|
||||
#[track_caller]
|
||||
pub fn with_senders(self, senders: Vec<Address>) -> BlockWithSenders {
|
||||
assert_eq!(self.body.len(), senders.len(), "Unequal number of senders");
|
||||
let senders = if self.body.len() == senders.len() {
|
||||
senders
|
||||
} else {
|
||||
TransactionSigned::recover_signers(&self.body, self.body.len())
|
||||
.expect("stored block is valid")
|
||||
};
|
||||
|
||||
BlockWithSenders { block: self, senders }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user