Class: Reth::TransientBlock

Inherits:
Object
  • Object
show all
Includes:
RLP::Sedes::Serializable
Defined in:
lib/reth/transient_block.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block_data, newblock_timestamp = 0) ⇒ TransientBlock

Returns a new instance of TransientBlock.



16
17
18
19
20
21
22
23
# File 'lib/reth/transient_block.rb', line 16

def initialize(block_data, newblock_timestamp=0)
  @newblock_timestamp = newblock_timestamp

  header = BlockHeader.deserialize block_data[0]
  transaction_list = RLP::Sedes::CountableList.new(Transaction).deserialize block_data[1]
  uncles = RLP::Sedes::CountableList.new(BlockHeader).deserialize block_data[2]
  super(header, transaction_list, uncles)
end

Instance Attribute Details

#newblock_timestampObject (readonly)

Returns the value of attribute newblock_timestamp.



14
15
16
# File 'lib/reth/transient_block.rb', line 14

def newblock_timestamp
  @newblock_timestamp
end

Instance Method Details

#full_hash_hexObject



29
30
31
# File 'lib/reth/transient_block.rb', line 29

def full_hash_hex
  header.full_hash_hex
end

#to_block(env, parent = nil) ⇒ Object



25
26
27
# File 'lib/reth/transient_block.rb', line 25

def to_block(env, parent=nil)
  Block.new header: header, transaction_list: transaction_list, uncles: uncles, env: env, parent: parent
end

#to_sObject Also known as: inspect



33
34
35
# File 'lib/reth/transient_block.rb', line 33

def to_s
  "<TransientBlock(##{header.number} #{header.full_hash_hex[0,8]})"
end