Class: Ethereum::TransientTrie

Inherits:
Trie show all
Defined in:
lib/ethereum/transient_trie.rb

Defined Under Namespace

Classes: InvalidTransientTrieOperation

Constant Summary

Constants inherited from Trie

Ethereum::Trie::BLANK_NODE, Ethereum::Trie::BLANK_ROOT, Ethereum::Trie::BRANCH_CARDINAL, Ethereum::Trie::BRANCH_WIDTH, Ethereum::Trie::KV_WIDTH, Ethereum::Trie::NODE_KV_TYPE, Ethereum::Trie::NODE_TYPES

Instance Attribute Summary

Attributes inherited from Trie

#db

Instance Method Summary collapse

Methods inherited from Trie

#clear, #each, #find, #has_key?, #initialize, #root_hash_valid?, #size, #to_h

Constructor Details

This class inherits a constructor from Ethereum::Trie

Instance Method Details

#root_hashObject



16
17
18
# File 'lib/ethereum/transient_trie.rb', line 16

def root_hash
  @transient_root_hash
end

#set_root_hash(hash) ⇒ Object

Raises:

  • (TypeError)


20
21
22
23
24
25
# File 'lib/ethereum/transient_trie.rb', line 20

def set_root_hash(hash)
  raise TypeError, "root hash must be String" unless hash.instance_of?(String)
  raise ArgumentError, "root hash must be 0 or 32 bytes long" unless [0,32].include?(hash.size)

  @transient_root_hash = hash
end

#transient_trie_exception(*args) ⇒ Object Also known as: [], []=, delete



8
9
10
# File 'lib/ethereum/transient_trie.rb', line 8

def transient_trie_exception(*args)
  raise InvalidTransientTrieOperation
end