@@ -26,9 +26,8 @@ const (
2626)
2727
2828var (
29- log = logger .GetOrCreate ("indexer/process/block" )
30- errNilBlockData = errors .New ("nil block data" )
31- errNilHeaderGasConsumed = errors .New ("nil header gas consumed data" )
29+ log = logger .GetOrCreate ("indexer/process/block" )
30+ errNilBlockData = errors .New ("nil block data" )
3231)
3332
3433type blockProcessor struct {
@@ -67,9 +66,6 @@ func (bp *blockProcessor) PrepareBlockForDB(obh *outport.OutportBlockWithHeader)
6766 if obh .BlockData .Body == nil {
6867 return nil , indexer .ErrNilBlockBody
6968 }
70- if obh .HeaderGasConsumption == nil {
71- return nil , errNilHeaderGasConsumed
72- }
7369
7470 blockSizeInBytes , err := bp .computeBlockSize (obh .BlockData .HeaderBytes , obh .BlockData .Body )
7571 if err != nil {
@@ -102,10 +98,6 @@ func (bp *blockProcessor) PrepareBlockForDB(obh *outport.OutportBlockWithHeader)
10298 PrevHash : hex .EncodeToString (obh .Header .GetPrevHash ()),
10399 SearchOrder : computeBlockSearchOrder (obh .Header ),
104100 EpochStartBlock : obh .Header .IsStartOfEpochBlock (),
105- GasProvided : obh .HeaderGasConsumption .GasProvided ,
106- GasRefunded : obh .HeaderGasConsumption .GasRefunded ,
107- GasPenalized : obh .HeaderGasConsumption .GasPenalized ,
108- MaxGasLimit : obh .HeaderGasConsumption .MaxGasPerBlock ,
109101 AccumulatedFees : converters .BigIntToString (obh .Header .GetAccumulatedFees ()),
110102 DeveloperFees : converters .BigIntToString (obh .Header .GetDeveloperFees ()),
111103 RandSeed : hex .EncodeToString (obh .Header .GetRandSeed ()),
@@ -119,6 +111,13 @@ func (bp *blockProcessor) PrepareBlockForDB(obh *outport.OutportBlockWithHeader)
119111 UUID : converters .GenerateBase64UUID (),
120112 }
121113
114+ if obh .HeaderGasConsumption != nil {
115+ elasticBlock .MaxGasLimit = obh .HeaderGasConsumption .MaxGasPerBlock
116+ elasticBlock .GasPenalized = obh .HeaderGasConsumption .GasPenalized
117+ elasticBlock .GasProvided = obh .HeaderGasConsumption .GasProvided
118+ elasticBlock .GasRefunded = obh .HeaderGasConsumption .GasRefunded
119+ }
120+
122121 additionalData := obh .Header .GetAdditionalData ()
123122 if obh .Header .GetAdditionalData () != nil {
124123 elasticBlock .ScheduledData = & data.ScheduledData {
@@ -207,6 +206,13 @@ func (bp *blockProcessor) prepareExecutionResult(baseExecutionResult coreData.Ba
207206
208207 executionResult .MiniBlocksHashes = bp .getEncodedMBSHashes (executionResultData .Body , executionResultData .IntraShardMiniBlocks )
209208 executionResult .TimestampMs = executionResultData .TimestampMs
209+ if executionResultData .HeaderGasConsumption != nil {
210+ executionResult .GasProvided = executionResultData .HeaderGasConsumption .GasProvided
211+ executionResult .GasRefunded = executionResultData .HeaderGasConsumption .GasRefunded
212+ executionResult .GasPenalized = executionResultData .HeaderGasConsumption .GasPenalized
213+ executionResult .MaxGasLimit = executionResultData .HeaderGasConsumption .MaxGasPerBlock
214+
215+ }
210216
211217 switch t := baseExecutionResult .(type ) {
212218 case * nodeBlock.MetaExecutionResult :
0 commit comments