mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(storage, tree): respect Sender Recovery pruning in the blockchain tree (#4431)
This commit is contained in:
@ -468,6 +468,10 @@ mod tests {
|
||||
{
|
||||
let provider = factory.provider_rw().unwrap();
|
||||
assert_matches!(provider.insert_block(block.clone(), None, None), Ok(_));
|
||||
assert_matches!(
|
||||
provider.transaction_sender(0), Ok(Some(sender))
|
||||
if sender == block.body[0].recover_signer().unwrap()
|
||||
);
|
||||
assert_matches!(provider.transaction_id(block.body[0].hash), Ok(Some(0)));
|
||||
}
|
||||
|
||||
@ -478,12 +482,14 @@ mod tests {
|
||||
block.clone(),
|
||||
None,
|
||||
Some(&PruneModes {
|
||||
sender_recovery: Some(PruneMode::Full),
|
||||
transaction_lookup: Some(PruneMode::Full),
|
||||
..PruneModes::none()
|
||||
})
|
||||
),
|
||||
Ok(_)
|
||||
);
|
||||
assert_matches!(provider.transaction_sender(0), Ok(None));
|
||||
assert_matches!(provider.transaction_id(block.body[0].hash), Ok(None));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1980,7 +1980,15 @@ impl<'this, TX: DbTxMut<'this> + DbTx<'this>> BlockWriter for DatabaseProvider<'
|
||||
|
||||
for (transaction, sender) in tx_iter {
|
||||
let hash = transaction.hash();
|
||||
self.tx.put::<tables::TxSenders>(next_tx_num, sender)?;
|
||||
|
||||
if prune_modes
|
||||
.and_then(|modes| modes.sender_recovery)
|
||||
.filter(|prune_mode| prune_mode.is_full())
|
||||
.is_none()
|
||||
{
|
||||
self.tx.put::<tables::TxSenders>(next_tx_num, sender)?;
|
||||
}
|
||||
|
||||
self.tx.put::<tables::Transactions>(next_tx_num, transaction.into())?;
|
||||
|
||||
if prune_modes
|
||||
|
||||
Reference in New Issue
Block a user