From 8a99cc82008243f66a49db1d7ae4cc78f3f7f3df Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Sat, 21 Sep 2024 11:43:17 +0100 Subject: [PATCH] Optimize out DaoTransition call --- .../Nethermind.Consensus/Processing/BlockProcessor.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.cs b/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.cs index 690e31b3274..e9d3dea3354 100644 --- a/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.cs +++ b/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.cs @@ -5,6 +5,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Numerics; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; @@ -427,7 +428,14 @@ private void ApplyMinerReward(Block block, BlockReward reward, IReleaseSpec spec // TODO: block processor pipeline private void ApplyDaoTransition(Block block) { - if (_specProvider.DaoBlockNumber.HasValue && _specProvider.DaoBlockNumber.Value == block.Header.Number) + long? daoBlockNumber = _specProvider.DaoBlockNumber; + if (daoBlockNumber.HasValue && daoBlockNumber.Value == block.Header.Number) + { + ApplyTransition(); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + void ApplyTransition() { if (_logger.IsInfo) _logger.Info("Applying the DAO transition"); Address withdrawAccount = DaoData.DaoWithdrawalAccount;