File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,9 @@ pub trait Block: Debug {
5858 /// Get gas limit
5959 fn gas_limit ( & self ) -> U256 ;
6060
61+ /// Get gas used
62+ fn gas_used ( & self ) -> U256 ;
63+
6164 /// Get base fee per gas
6265 fn base_fee_per_gas ( & self ) -> Option < U256 > ;
6366
@@ -292,6 +295,10 @@ impl<T: Block> Block for &T {
292295 ( * self ) . gas_limit ( )
293296 }
294297
298+ fn gas_used ( & self ) -> U256 {
299+ ( * self ) . gas_used ( )
300+ }
301+
295302 fn base_fee_per_gas ( & self ) -> Option < U256 > {
296303 ( * self ) . base_fee_per_gas ( )
297304 }
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ struct BlockHeader {
2222 /// gas limit
2323 #[ serde( rename = "gasLimit" ) ]
2424 gas_limit : U256 ,
25+ /// gas used
26+ #[ serde( rename = "gasUsed" ) ]
27+ gas_used : U256 ,
2528 /// base fee per gas
2629 #[ serde( rename = "baseFeePerGas" ) ]
2730 base_fee_per_gas : Option < U256 > ,
@@ -136,6 +139,10 @@ impl Block for BlockTrace {
136139 self . header . gas_limit
137140 }
138141
142+ fn gas_used ( & self ) -> U256 {
143+ self . header . gas_used
144+ }
145+
139146 fn base_fee_per_gas ( & self ) -> Option < U256 > {
140147 self . header . base_fee_per_gas
141148 }
@@ -207,6 +214,10 @@ impl Block for ArchivedBlockTrace {
207214 self . header . gas_limit
208215 }
209216
217+ fn gas_used ( & self ) -> U256 {
218+ self . header . gas_used
219+ }
220+
210221 fn base_fee_per_gas ( & self ) -> Option < U256 > {
211222 self . header . base_fee_per_gas . as_ref ( ) . copied ( )
212223 }
You can’t perform that action at this time.
0 commit comments