mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-10 15:05:24 -05:00
fix: increment post block balances in invalid block hook (#11139)
This commit is contained in:
@@ -16,6 +16,7 @@ use reth_revm::{
|
||||
database::StateProviderDatabase,
|
||||
db::states::bundle_state::BundleRetention,
|
||||
primitives::{BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg},
|
||||
state_change::post_block_balance_increments,
|
||||
DatabaseCommit, StateBuilder,
|
||||
};
|
||||
use reth_rpc_api::DebugApiClient;
|
||||
@@ -114,6 +115,17 @@ where
|
||||
|
||||
drop(evm);
|
||||
|
||||
// use U256::MAX here for difficulty, because fetching it is annoying
|
||||
// NOTE: This is not mut because we are not doing the DAO irregular state change here
|
||||
let balance_increments = post_block_balance_increments(
|
||||
self.provider.chain_spec().as_ref(),
|
||||
&block.block.clone().unseal(),
|
||||
U256::MAX,
|
||||
);
|
||||
|
||||
// increment balances
|
||||
db.increment_balances(balance_increments)?;
|
||||
|
||||
// Merge all state transitions
|
||||
db.merge_transitions(BundleRetention::Reverts);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user