Class: Reth::JSONRPC::BlockFilter
- Inherits:
-
Object
- Object
- Reth::JSONRPC::BlockFilter
- Defined in:
- lib/reth/jsonrpc/filter.rb
Class Method Summary collapse
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(chain) ⇒ BlockFilter
constructor
A new instance of BlockFilter.
Constructor Details
#initialize(chain) ⇒ BlockFilter
Returns a new instance of BlockFilter.
226 227 228 229 |
# File 'lib/reth/jsonrpc/filter.rb', line 226 def initialize(chain) @chain = chain @latest_block = chain.head end |
Class Method Details
Instance Method Details
#check ⇒ Object
231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/reth/jsonrpc/filter.rb', line 231 def check new_blocks = [] block = @chain.head while block.number > @latest_block.number new_blocks.push block block = block.get_parent end puts "previous latest block not in current chain!" if block != @latest_block @latest_block = new_blocks.first if new_blocks.size > 0 new_blocks.reverse end |