Class: Paleth::SyncState

Inherits:
Object
  • Object
show all
Defined in:
lib/paleth/syncing.rb

Overview

Represents the Synchronization state of the ethereum client with the network

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state) ⇒ SyncState

:nodoc:


8
9
10
# File 'lib/paleth/syncing.rb', line 8

def initialize(state)
  @state = state
end

Instance Attribute Details

#stateObject (readonly)

Returns the value of attribute state


5
6
7
# File 'lib/paleth/syncing.rb', line 5

def state
  @state
end

Instance Method Details

#currentObject

The block number where at which block the node currently synced to already.


19
20
21
# File 'lib/paleth/syncing.rb', line 19

def current
  @state.JS[:currentBlock]
end

#highestObject

The estimated block number to sync to


24
25
26
# File 'lib/paleth/syncing.rb', line 24

def highest
  @state.JS[:highestBlock]
end

#startingObject

The block number where the sync started.


13
14
15
# File 'lib/paleth/syncing.rb', line 13

def starting
  @state.JS[:startingBlock]
end

#to_sObject

Pretty printer


29
30
31
# File 'lib/paleth/syncing.rb', line 29

def to_s
  "SyncState(starting=#{starting}, current=#{current}, highest=#{highest})"
end